Commit 666a9e28a2815bcf4f43c81391456cceb8e21f8a
1 parent
98c12c22df
Exists in
master
auto_now_add on userflashcard.pulled
Showing 2 changed files with 23 additions and 1 deletions Side-by-side Diff
flashcards/migrations/0003_auto_20150521_0203.py
View file @
666a9e2
1 | +# -*- coding: utf-8 -*- | |
2 | +from __future__ import unicode_literals | |
3 | + | |
4 | +from django.db import models, migrations | |
5 | +import datetime | |
6 | +from django.utils.timezone import utc | |
7 | + | |
8 | + | |
9 | +class Migration(migrations.Migration): | |
10 | + | |
11 | + dependencies = [ | |
12 | + ('flashcards', '0002_auto_20150520_1322'), | |
13 | + ] | |
14 | + | |
15 | + operations = [ | |
16 | + migrations.AlterField( | |
17 | + model_name='userflashcard', | |
18 | + name='pulled', | |
19 | + field=models.DateTimeField(default=datetime.datetime(2015, 5, 21, 9, 3, 53, 345704, tzinfo=utc), help_text=b'When the user pulled the card', auto_now_add=True), | |
20 | + preserve_default=False, | |
21 | + ), | |
22 | + ] |
flashcards/models.py
View file @
666a9e2
... | ... | @@ -129,7 +129,7 @@ |
129 | 129 | user = ForeignKey('User') |
130 | 130 | mask = MaskField(max_length=255, null=True, blank=True, default=None, |
131 | 131 | help_text="The user-specific mask on the card") |
132 | - pulled = DateTimeField(blank=True, null=True, default=None, help_text="When the user pulled the card") | |
132 | + pulled = DateTimeField(auto_now_add=True, help_text="When the user pulled the card") | |
133 | 133 | flashcard = ForeignKey('Flashcard') |
134 | 134 | |
135 | 135 | class Meta: |