#20267: default form values (not just initial)
-----------------------------+---------------------------
     Reporter:  clime        |      Owner:  nobody
         Type:  New feature  |     Status:  new
    Component:  Forms        |    Version:  1.5
     Severity:  Normal       |   Keywords:  form, default
 Triage Stage:  Unreviewed   |  Has patch:  0
Easy pickings:  0            |      UI/UX:  0
-----------------------------+---------------------------
 Hello,

 I am finding the "initial" functionality on forms lacking.

 With this form:

 {{{
 class Form(forms.Form):
     name = forms.CharField(required=False, initial='Hello world')
 }}}


 If in view, I do something like:


 {{{
 form = Form(request.GET)
 if form.is_valid():
     name = form.cleaned_data['name']
 }}}

 Then initial value of name is lost even if request.GET does not contain
 name as key.

 Why there is not just "default" attribute that would maintain the default
 value until being explicitly overwritten by request data? There are so few
 things I find inconvenient in Django but this is one of them.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/20267>
Django <https://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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to