Opened 8 years ago

Closed 8 years ago

Last modified 8 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


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:

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

Change History (2)

comment:1 Changed 8 years ago by Tim Graham

Resolution: duplicate
Status: newclosed

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

comment:2 Changed 8 years ago by David Seddon

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

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