The issue is that `SelectDateWidget.value_from_datadict` does not return a
value that would be matched by `SelectDateWidget.date_re`.
The returns from `SelectDateWidget.value_from_datadict` should probably
be formatted as follows
{{{
#!python
return '{:04d}-{:d}-{:d}'.format(y, m, d)
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/27724>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Comment (by tpazderka):
Another option would be to modify `SelectDateWidget.date_re` to math the
output from `value_from_datadict`
{{{
date_re = re.compile(r'(\d+)-(\d\d?)-(\d\d?)$')
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/27724#comment:1>
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/27724#comment:2>
* status: new => assigned
* owner: nobody => Adonys Alea Boffill
--
Ticket URL: <https://code.djangoproject.com/ticket/27724#comment:3>
* Attachment "ticket_27724.diff" added.
* has_patch: 0 => 1
Comment:
To fix this ticket I changed the regular expresion of
`SelectDateWidget.date_re` from:
{{{
date_re = re.compile(r'(\d{4})-(\d\d?)-(\d\d?)$')
}}}
to:
{{{
date_re = re.compile(r'(\d{4}|0)-(\d\d?)-(\d\d?)$')
}}}
I added `0` to the year possible value because `0` is set as default value
of year's `Select`, and I kept the restriction of 4 digits for a valid
year value. I added tests for the `SelectDateWidget.date_re` expression.
--
Ticket URL: <https://code.djangoproject.com/ticket/27724#comment:4>
Comment (by Tim Graham):
Could you please send a pull request rather than attaching a patch to the
ticket?
--
Ticket URL: <https://code.djangoproject.com/ticket/27724#comment:5>
* needs_better_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/27724#comment:6>
Comment (by Adonys Alea Boffill):
OK Tim!, I'll work on that this week... thanks for your comment.
--
Ticket URL: <https://code.djangoproject.com/ticket/27724#comment:7>
Comment (by Adonys Alea Boffill):
I added the pull request... https://github.com/django/django/pull/8108, I
hope to cover with all expectations.
--
Ticket URL: <https://code.djangoproject.com/ticket/27724#comment:8>
Comment (by Adonys Alea Boffill):
Added PR (https://github.com/django/django/pull/8206) with non regressions
tests suggested by Tim!
--
Ticket URL: <https://code.djangoproject.com/ticket/27724#comment:9>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"cd2ad26cc9369ea470ae72349633791c66887157" cd2ad26c]:
{{{
#!CommitTicketReference repository=""
revision="cd2ad26cc9369ea470ae72349633791c66887157"
Fixed #27724 -- Fixed SelectDateWidget redisplay if a year isn't chosen.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/27724#comment:10>