Opened 13 years ago

Closed 13 years ago

#17542 closed Bug (fixed)

SelectDateWidget with required=false throws exception in _has_changed

Reported by: x.g10f.de Owned by: Maciej Wiśniowski
Component: Forms Version: 1.4-alpha-1
Severity: Normal Keywords: SelectDateWidget required false
Cc: restless.being@… Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

When accessing changed_data in a form with SelectDateWidget with required=false and no values for year, month and date selected i get an exception.
The exception is thrown in strptime in

Code highlighting:

  def _has_changed(self, initial, data):
      input_format = get_format('DATE_INPUT_FORMATS')[0]
      data = datetime_safe.datetime.strptime(data, input_format).date()
      return super(SelectDateWidget, self)._has_changed(initial, data)  

because data is None

Attachments (1)

patch_for_17542.diff (1.8 KB ) - added by Maciej Wiśniowski 13 years ago.

Download all attachments as: .zip

Change History (7)

comment:1 by Maciej Wiśniowski, 13 years ago

Needs tests: set
Owner: changed from nobody to Maciej Wiśniowski

comment:2 by Maciej Wiśniowski, 13 years ago

Component: UncategorizedForms
Status: newassigned

comment:3 by Maciej Wiśniowski, 13 years ago

Triage Stage: UnreviewedAccepted
Type: UncategorizedBug

by Maciej Wiśniowski, 13 years ago

Attachment: patch_for_17542.diff added

comment:4 by Maciej Wiśniowski, 13 years ago

Has patch: set

comment:5 by Jakub Wiśniowski, 13 years ago

Cc: restless.being@… added
Needs tests: unset
Triage Stage: AcceptedReady for checkin

Review done. It works.

comment:6 by Jannis Leidel, 13 years ago

Resolution: fixed
Status: assignedclosed

In [17436]:

(The changeset message doesn't reference this ticket)

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