Opened 15 years ago

Closed 15 years ago

#11673 closed (duplicate)

submitting an empty forms.DateTimeField fails even with models null and blank and required=False for the form field

Reported by: Skylar Saveland <skylar.saveland@…> Owned by: nobody
Component: Uncategorized Version: 1.1
Severity: 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 have a model like:

class Event(models.Model):
    ... 
    end = models.DateTimeField(blank=True, null=True) 
    ...

and a modelform like:

from django import forms from events.models import Event

class EventForm(forms.ModelForm):

    end = forms.DateTimeField(('%m/%d/%Y %H:%M',),

        widget=forms.SplitDateTimeWidget(

            date_format='%m/%d/%Y', time_format='%H:%M',

        ), required=False

    )

    class Meta:

        model = Event

submitting an empty field will cause a validation error.

Change History (1)

comment:1 by Alex Gaynor, 15 years ago

Resolution: duplicate
Status: newclosed

Closing as a dupe of #11672 since I reformatted that one. Please don't open a second ticket, someone with edit privledges can fix it up.

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