Opened 19 years ago

Closed 19 years ago

Last modified 18 years ago

#337 closed defect (fixed)

DateTime fields don't work in the generic views

Reported by: mlambert@… 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)

cu.diff (876 bytes ) - added by mlambert@… 19 years ago.
diff that fixes #337 and #338

Download all attachments as: .zip

Change History (11)

comment:1 by mr_little, 19 years ago

Look at admin-pages head, and add to generic templates html head necessary javascripts from admin media

comment:2 by mlambert@…, 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:3 by anonymous, 19 years ago

Please fix soon. Very frustrating that the fields are not updated.

comment:4 by Jacob, 19 years ago

Component: Template systemGeneric views
Owner: changed from Adrian Holovaty to Jacob
Status: newassigned

comment:5 by deltabps, 19 years ago

Severity: normalmajor

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 mlambert@…, 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)

by mlambert@…, 19 years ago

Attachment: cu.diff added

diff that fixes #337 and #338

comment:7 by Jacob, 19 years ago

milestone: Version 1.0

comment:8 by rjwittams, 19 years ago

Keywords: new-admin added

This is fixed in new-admin

comment:9 by rjwittams, 19 years ago

Resolution: fixed
Status: assignedclosed

fixed in new-admin merge . People still have to manually include javascript.

comment:10 by (none), 18 years ago

milestone: Version 1.0

Milestone Version 1.0 deleted

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