#337 closed defect (fixed)
DateTime fields don't work in the generic views
Reported by: | Owned by: | Jacob | |
---|---|---|---|
Component: | Generic views | Version: | |
Severity: | major | Keywords: | new-admin |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
fieldname_date and fieldname_time aren't set on the data dictionary, so the form fields come up blank
And similarly, jacobkm said that this also needs the server to recombine these fields back into plain old fieldname on the POST-side.
Attachments (1)
Change History (11)
comment:1 by , 19 years ago
comment:2 by , 19 years ago
I don't quite know what you mean in the above comment, mr_little. I don't believe it's an issue of javascript. I believe this is because _get_flattened_data is only called for admin views, and the code needs to run for generic views as well., to set up fieldname_date and fieldname_time.
comment:4 by , 19 years ago
Component: | Template system → Generic views |
---|---|
Owner: | changed from | to
Status: | new → assigned |
comment:5 by , 19 years ago
Severity: | normal → major |
---|
Yes, please fix this soon. I try to get my view on the appropriate code, perhaps I could help.
This is a show-stopper for my django project :(
comment:6 by , 19 years ago
So the quick hack-fix for this is:
In views/generic/create_update.py, in the big else statement for the request.POST check, after "new_data = object.dict", add:
from django.views.admin.main import _get_mod_opts, _get_flattened_data
mod, opts = _get_mod_opts(app_label, module_name)
for f in opts.fields:
new_data.update(_get_flattened_data(f, getattr(object, f.column)))
Basically, a c&p of the code from the admin interface to use the functions that we need in the generic views. I'm keeping this simple fix until the django developers get around to implemeting a more proper fix (involving code reorganization and such to avoid generic views' reliance on admin stuff)
comment:7 by , 19 years ago
milestone: | → Version 1.0 |
---|
comment:9 by , 19 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
fixed in new-admin merge . People still have to manually include javascript.
Look at admin-pages head, and add to generic templates html head necessary javascripts from admin media