jazzband / jazzband/django-floppyforms

SelectDateWidget fault during rendering

Open
#78 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
836
Forks
150
PR merge metrics
No merged PRs in 30d

Description

Hi there,

I discovered that the rendering of a SelectDateWidget makes a fault when rendering the value. It expects a date object or a unicode string, but it receives a normal string.
I'm using floppyforms-1.1.
The mistake appears to be made in the 'def value_from_datadict' (line 649) here the date value is returned as a normal string while the 'def render' expects a unicode string -> if isinstance(value, six.text_type): (line 607).

The steps i follow to reproduce this error:
When i update a form that contains a SelectDateWidget field and during the update a validation error occurs (on an other field than the SelectDateWidget), the SelectDateWidget doesn't render the persistent date and the view displays the default date and not the actual persistent date.

Contributor guide

Open the contributing guide

Research direction

Start by reading SelectDateWidget.value_from_datadict around line 649 and render around line 607. Reproduce the validation-error case on another form field, then verify that the widget renders the persistent date rather than the default date.

Written by the indexing model from the issue text.

Assessment

Tech stack
django, python
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.