Commit f0ac627bcd07a54e9ed26000edc132894dd20ff4

Authored by Andrew Buss
1 parent 336f8126dd
Exists in master

increase char limit to 180, enforce min 5 chars

Showing 2 changed files with 22 additions and 1 deletions Side-by-side Diff

flashcards/migrations/0006_auto_20150528_2146.py View file @ f0ac627
  1 +# -*- coding: utf-8 -*-
  2 +from __future__ import unicode_literals
  3 +
  4 +from django.db import models, migrations
  5 +import django.core.validators
  6 +
  7 +
  8 +class Migration(migrations.Migration):
  9 +
  10 + dependencies = [
  11 + ('flashcards', '0005_auto_20150528_0119'),
  12 + ]
  13 +
  14 + operations = [
  15 + migrations.AlterField(
  16 + model_name='flashcard',
  17 + name='text',
  18 + field=models.CharField(help_text=b'The text on the card', max_length=180, validators=[django.core.validators.MinLengthValidator(5)]),
  19 + ),
  20 + ]
flashcards/models.py View file @ f0ac627
... ... @@ -7,6 +7,7 @@
7 7 from django.core.exceptions import ValidationError
8 8 from django.core.exceptions import PermissionDenied, SuspiciousOperation
9 9 from django.core.mail import send_mail
  10 +from django.core.validators import MinLengthValidator
10 11 from django.db import IntegrityError
11 12 from django.db.models import *
12 13 from django.utils.timezone import now, make_aware
... ... @@ -173,7 +174,7 @@
173 174  
174 175  
175 176 class Flashcard(Model):
176   - text = CharField(max_length=140, help_text='The text on the card')
  177 + text = CharField(max_length=180, help_text='The text on the card', validators=[MinLengthValidator(5)])
177 178 section = ForeignKey('Section', help_text='The section with which the card is associated')
178 179 pushed = DateTimeField(auto_now_add=True, help_text="When the card was first pushed")
179 180 material_date = DateTimeField(default=now, help_text="The date with which the card is associated")