From f0ac627bcd07a54e9ed26000edc132894dd20ff4 Mon Sep 17 00:00:00 2001 From: Andrew Buss Date: Thu, 28 May 2015 21:51:16 -0700 Subject: [PATCH] increase char limit to 180, enforce min 5 chars --- flashcards/migrations/0006_auto_20150528_2146.py | 20 ++++++++++++++++++++ flashcards/models.py | 3 ++- 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 flashcards/migrations/0006_auto_20150528_2146.py diff --git a/flashcards/migrations/0006_auto_20150528_2146.py b/flashcards/migrations/0006_auto_20150528_2146.py new file mode 100644 index 0000000..4710ea3 --- /dev/null +++ b/flashcards/migrations/0006_auto_20150528_2146.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations +import django.core.validators + + +class Migration(migrations.Migration): + + dependencies = [ + ('flashcards', '0005_auto_20150528_0119'), + ] + + operations = [ + migrations.AlterField( + model_name='flashcard', + name='text', + field=models.CharField(help_text=b'The text on the card', max_length=180, validators=[django.core.validators.MinLengthValidator(5)]), + ), + ] diff --git a/flashcards/models.py b/flashcards/models.py index fff4109..3a52c83 100644 --- a/flashcards/models.py +++ b/flashcards/models.py @@ -7,6 +7,7 @@ from django.core.cache import cache from django.core.exceptions import ValidationError from django.core.exceptions import PermissionDenied, SuspiciousOperation from django.core.mail import send_mail +from django.core.validators import MinLengthValidator from django.db import IntegrityError from django.db.models import * from django.utils.timezone import now, make_aware @@ -173,7 +174,7 @@ class FlashcardHide(Model): class Flashcard(Model): - text = CharField(max_length=140, help_text='The text on the card') + text = CharField(max_length=180, help_text='The text on the card', validators=[MinLengthValidator(5)]) section = ForeignKey('Section', help_text='The section with which the card is associated') pushed = DateTimeField(auto_now_add=True, help_text="When the card was first pushed") material_date = DateTimeField(default=now, help_text="The date with which the card is associated") -- 1.9.1