Code

Opened 5 years ago

Closed 5 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: UI/UX:

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.

Attachments (0)

Change History (1)

comment:1 Changed 5 years ago by Alex

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to duplicate
  • Status changed from new to closed

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.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.