#12986: SelectDateField doesn't repost data when USE_L10N = True and 
LANGUAGE_CODE
= 'nl'
---------------------------------------+------------------------------------
          Reporter:  w...@go2people.nl  |         Owner:  nobody  
            Status:  new               |     Milestone:          
         Component:  Forms             |       Version:  1.2-beta
        Resolution:                    |      Keywords:          
             Stage:  Unreviewed        |     Has_patch:  0       
        Needs_docs:  0                 |   Needs_tests:  0       
Needs_better_patch:  0                 |  
---------------------------------------+------------------------------------
Comment (by anonymous):

 Wow, that did look ugly, didn't it? Let's retry:

 {{{
 #-- forms.py

 from django.forms.extras import SelectDateWidget

 class ConceptTripForm(forms.Form):
     required = forms.CharField()
     date = forms.DateField(label="Datum", required=True,
 widget=SelectDateWidget())

 #-- views.py
 from forms import ConcepTripForm

 @render_to('trips/formtest.html')
 def form_test(request):
     if request.POST:
         form = ConceptTripForm(request.POST)
         if form.is_valid():
             print "Wow!"
             return HttpResponseRedirect('/')
     else:
         form = ConceptTripForm()
     return {'form': form,}

 #-- formtest.html
 <form action="." method="POST">
 <table>{% csrf_token %}
     {{ form }}
     <input type="submit" name="OK" value="OK">
 </table>
 </form>
 }}}

 When I enter:
 Required:  (nothing)
 Datum:  2 februari 2011

 What I get is a form error, obviously. But unfortunately, the date has
 been reset. So after the error the form shows:
 * Dit veld is verplicht. (Translation: This field is required.)
 Required:  (nothing)
 Datum: 1 januari 2010

 So the date I entered is gone.

 I hope this description helps. Thanks!

-- 
Ticket URL: <http://code.djangoproject.com/ticket/12986#comment:4>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to