#23998 closed Bug (fixed)
datetime.time default value on migrations
Reported by: | Oscar Ramirez | Owned by: | Oscar Ramirez |
---|---|---|---|
Component: | Migrations | Version: | 1.7 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Pull Requests: | |||
Description ¶
When trying to use datetime.time(10)
value for a django.db.models.fields.TimeField
model default value on the default value questioner the system raises this exception:
The datetime module is available, so you can do e.g. datetime.date.today() >>> datetime.time(10) Traceback (most recent call last): File "manage.py", line 10, in <module> execute_from_command_line(sys.argv) [....] File "/Users/tuxskar/.virtualenvs/caluny/lib/python2.7/site-packages/django/db/migrations/questioner.py", line 126, in ask_not_null_addition return eval(code, {}, {"datetime": datetime_safe}) File "<string>", line 1, in <module> TypeError: 'module' object is not callable
I have made a patch and attach here. (Github Pull Request)
Change History (6)
comment:1 by , 10 years ago
Has patch: | unset |
---|---|
Resolution: | → needsinfo |
Status: | new → closed |
comment:2 by , 10 years ago
Resolution: | needsinfo |
---|---|
Status: | closed → new |
The patch is linked in the "Pull Requests:" field on the ticket. The problem is with the migration questioner, not the plain Django shell.
comment:3 by , 10 years ago
Has patch: | set |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:5 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Can you provide the steps to reproduce the bug, more clearly? I don't get any error when I enter the following in the shell of django 1.7:
Is that what you meant?
Also, you have mentioned that a patch has been attached but I couldn't find any attachments.