Opened 16 years ago
Closed 16 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: | 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.
Note:
See TracTickets
for help on using tickets.
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.