From 336f8126dd46c4f7dd5d7ef7be3ced53af2f644b Mon Sep 17 00:00:00 2001 From: Andrew Buss Date: Thu, 28 May 2015 01:19:57 -0700 Subject: [PATCH] reduce char limit to 140 --- flashcards/migrations/0005_auto_20150528_0119.py | 30 ++++++++++++++++++++++++ flashcards/models.py | 10 ++++---- 2 files changed, 35 insertions(+), 5 deletions(-) create mode 100644 flashcards/migrations/0005_auto_20150528_0119.py diff --git a/flashcards/migrations/0005_auto_20150528_0119.py b/flashcards/migrations/0005_auto_20150528_0119.py new file mode 100644 index 0000000..9eba2b2 --- /dev/null +++ b/flashcards/migrations/0005_auto_20150528_0119.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations +import flashcards.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ('flashcards', '0004_user_confirmed_email'), + ] + + operations = [ + migrations.AlterField( + model_name='flashcard', + name='mask', + field=flashcards.fields.MaskField(help_text=b'The mask on the card', range_sep=b'-', null=True, blank_sep=b',', blank=True), + ), + migrations.AlterField( + model_name='flashcard', + name='text', + field=models.CharField(help_text=b'The text on the card', max_length=140), + ), + migrations.AlterField( + model_name='userflashcard', + name='mask', + field=flashcards.fields.MaskField(default=None, blank_sep=b',', range_sep=b'-', blank=True, help_text=b'The user-specific mask on the card', null=True), + ), + ] diff --git a/flashcards/models.py b/flashcards/models.py index 0fceff2..fff4109 100644 --- a/flashcards/models.py +++ b/flashcards/models.py @@ -18,6 +18,7 @@ from cached_property import cached_property + # Hack to fix AbstractUser before subclassing it AbstractUser._meta.get_field('email')._unique = True @@ -136,8 +137,7 @@ class UserFlashcard(Model): 3. A user has a flashcard hidden from them """ user = ForeignKey('User') - mask = MaskField(max_length=255, null=True, blank=True, default=None, - help_text="The user-specific mask on the card") + mask = MaskField(null=True, blank=True, default=None, help_text="The user-specific mask on the card") pulled = DateTimeField(auto_now_add=True, help_text="When the user pulled the card") flashcard = ForeignKey('Flashcard') @@ -173,7 +173,7 @@ class FlashcardHide(Model): class Flashcard(Model): - text = CharField(max_length=255, help_text='The text on the card') + text = CharField(max_length=140, help_text='The text on the card') 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") @@ -183,7 +183,7 @@ class Flashcard(Model): is_hidden = BooleanField(default=False) hide_reason = CharField(blank=True, null=True, max_length=255, default='', help_text="Reason for hiding this card") - mask = MaskField(max_length=255, null=True, blank=True, help_text="The mask on the card") + mask = MaskField(null=True, blank=True, help_text="The mask on the card") class Meta: # By default, order by most recently pushed @@ -191,7 +191,7 @@ class Flashcard(Model): @property def material_week_num(self): - return (self.material_date-QUARTER_START).days/7+1 + return (self.material_date - QUARTER_START).days / 7 + 1 def is_hidden_from(self, user): """ -- 1.9.1