Commit 336f8126dd46c4f7dd5d7ef7be3ced53af2f644b
1 parent
1f74d60b26
Exists in
master
reduce char limit to 140
Showing 2 changed files with 35 additions and 5 deletions Side-by-side Diff
flashcards/migrations/0005_auto_20150528_0119.py
View file @
336f812
1 | +# -*- coding: utf-8 -*- | |
2 | +from __future__ import unicode_literals | |
3 | + | |
4 | +from django.db import models, migrations | |
5 | +import flashcards.fields | |
6 | + | |
7 | + | |
8 | +class Migration(migrations.Migration): | |
9 | + | |
10 | + dependencies = [ | |
11 | + ('flashcards', '0004_user_confirmed_email'), | |
12 | + ] | |
13 | + | |
14 | + operations = [ | |
15 | + migrations.AlterField( | |
16 | + model_name='flashcard', | |
17 | + name='mask', | |
18 | + field=flashcards.fields.MaskField(help_text=b'The mask on the card', range_sep=b'-', null=True, blank_sep=b',', blank=True), | |
19 | + ), | |
20 | + migrations.AlterField( | |
21 | + model_name='flashcard', | |
22 | + name='text', | |
23 | + field=models.CharField(help_text=b'The text on the card', max_length=140), | |
24 | + ), | |
25 | + migrations.AlterField( | |
26 | + model_name='userflashcard', | |
27 | + name='mask', | |
28 | + 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), | |
29 | + ), | |
30 | + ] |
flashcards/models.py
View file @
336f812
... | ... | @@ -18,6 +18,7 @@ |
18 | 18 | |
19 | 19 | |
20 | 20 | |
21 | + | |
21 | 22 | # Hack to fix AbstractUser before subclassing it |
22 | 23 | |
23 | 24 | AbstractUser._meta.get_field('email')._unique = True |
... | ... | @@ -136,8 +137,7 @@ |
136 | 137 | 3. A user has a flashcard hidden from them |
137 | 138 | """ |
138 | 139 | user = ForeignKey('User') |
139 | - mask = MaskField(max_length=255, null=True, blank=True, default=None, | |
140 | - help_text="The user-specific mask on the card") | |
140 | + mask = MaskField(null=True, blank=True, default=None, help_text="The user-specific mask on the card") | |
141 | 141 | pulled = DateTimeField(auto_now_add=True, help_text="When the user pulled the card") |
142 | 142 | flashcard = ForeignKey('Flashcard') |
143 | 143 | |
... | ... | @@ -173,7 +173,7 @@ |
173 | 173 | |
174 | 174 | |
175 | 175 | class Flashcard(Model): |
176 | - text = CharField(max_length=255, help_text='The text on the card') | |
176 | + text = CharField(max_length=140, help_text='The text on the card') | |
177 | 177 | section = ForeignKey('Section', help_text='The section with which the card is associated') |
178 | 178 | pushed = DateTimeField(auto_now_add=True, help_text="When the card was first pushed") |
179 | 179 | material_date = DateTimeField(default=now, help_text="The date with which the card is associated") |
... | ... | @@ -183,7 +183,7 @@ |
183 | 183 | is_hidden = BooleanField(default=False) |
184 | 184 | hide_reason = CharField(blank=True, null=True, max_length=255, default='', |
185 | 185 | help_text="Reason for hiding this card") |
186 | - mask = MaskField(max_length=255, null=True, blank=True, help_text="The mask on the card") | |
186 | + mask = MaskField(null=True, blank=True, help_text="The mask on the card") | |
187 | 187 | |
188 | 188 | class Meta: |
189 | 189 | # By default, order by most recently pushed |
... | ... | @@ -191,7 +191,7 @@ |
191 | 191 | |
192 | 192 | @property |
193 | 193 | def material_week_num(self): |
194 | - return (self.material_date-QUARTER_START).days/7+1 | |
194 | + return (self.material_date - QUARTER_START).days / 7 + 1 | |
195 | 195 | |
196 | 196 | def is_hidden_from(self, user): |
197 | 197 | """ |