Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#25573 closed Cleanup/optimization (duplicate)

Add simple way to use SplitDateTimeField on ModelForms

Reported by: David Seddon Owned by: nobody
Component: Forms Version: 1.9a1
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

If you specify a SplitDateTimeWidget as the custom widget for a DateTimeField on a ModelForm, you receive this deprecation warning:

RemovedInDjango19Warning: Using SplitDateTimeWidget with DateTimeField is deprecated. Use SplitDateTimeField instead.

My understanding is that the only way to do this for a ModelForm based on a model with a DateTimeField, is to subclass models.DateTimeField like this: https://gist.github.com/nacady/8dd5cab2f749d1589f1e.

Perhaps we should provide a simpler way of using the SplitDateTimeField with ModelForms?

Change History (2)

comment:1 by Tim Graham, 9 years ago

Resolution: duplicate
Status: newclosed

The ModelForm.Meta.field_classes feature added in Django 1.9 should allow this (#24295).

comment:2 by David Seddon, 9 years ago

Oh, great feature - yes, this will do the trick.

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