Opened 9 years ago

Closed 9 years ago

#22475 closed Bug (needsinfo)

model change with DateTime field

Reported by: niki75@… Owned by: nobody
Component: Migrations Version: 1.7-beta-1
Severity: Normal Keywords: datetime
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


I created a Model class with several field. next I added a models.DateTimeField field.
Next I just
python makemigrations [OK]

next I tried with:
python 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

field=models.DateTimeField(, 4, 18)),

I modified on this way and now it works.

Change History (1)

comment:1 Changed 9 years ago by Simon Charette

Resolution: needsinfo
Status: newclosed

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.

Note: See TracTickets for help on using tickets.
Back to Top