[Django] #22475: model change with DateTime field

39 views
Skip to first unread message

Django

unread,
Apr 18, 2014, 7:11:06 PM4/18/14
to django-...@googlegroups.com
#22475: model change with DateTime field
----------------------------+------------------------
Reporter: niki75@… | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 1.7-beta-1
Severity: Normal | Keywords: datetime
Triage Stage: Unreviewed | Has patch: 1
Easy pickings: 0 | UI/UX: 0
----------------------------+------------------------
I created a Model class with several field. next I added a
models.DateTimeField field.
Next I just
python manage.py makemigrations [OK]

next I tried with:
python manage.py migrate
but I received the following error:
field=models.DateTimeField(default=date(2014, 4, 18)),
NameError: name 'date' is not defined

I see in the migration file the import to datetime is present:
import datetime

but in the line where is defined the date is missing datetime.date
field=models.DateTimeField(default=datetime.date(2014, 4, 18)),

I modified on this way and now it works.

--
Ticket URL: <https://code.djangoproject.com/ticket/22475>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Apr 18, 2014, 8:26:47 PM4/18/14
to django-...@googlegroups.com
#22475: model change with DateTime field
----------------------------+--------------------------------------
Reporter: niki75@… | Owner: nobody
Type: Bug | Status: closed
Component: Migrations | Version: 1.7-beta-1
Severity: Normal | Resolution: needsinfo

Keywords: datetime | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
----------------------------+--------------------------------------
Changes (by charettes):

* status: new => closed
* needs_better_patch: => 0
* resolution: => needsinfo
* needs_tests: => 0
* needs_docs: => 0


Comment:

This looks like #22363 to me. Could confirm your default date was
specified as a one-off default when you created the migration?

If that's the case could you try reproducing against the master branch.

--
Ticket URL: <https://code.djangoproject.com/ticket/22475#comment:1>

Reply all
Reply to author
Forward
0 new messages