Ticket #5547: 5547_datetimefield_default_fix.diff

File 5547_datetimefield_default_fix.diff, 839 bytes (added by Brian Rosner, 17 years ago)
  • django/contrib/admin/options.py

    === django/contrib/admin/options.py
    ==================================================================
     
    150150
    151151        # For DateTimeFields, use a special field and widget.
    152152        if isinstance(db_field, models.DateTimeField):
    153             return forms.SplitDateTimeField(required=not db_field.blank,
    154                 widget=widgets.AdminSplitDateTime(), label=capfirst(db_field.verbose_name),
    155                 help_text=db_field.help_text, **kwargs)
     153            kwargs['form_class'] = forms.SplitDateTimeField
     154            kwargs['widget'] = widgets.AdminSplitDateTime()
     155            return db_field.formfield(**kwargs)
    156156
    157157        # For DateFields, add a custom CSS class.
    158158        if isinstance(db_field, models.DateField):
Back to Top