Opened 9 years ago

Closed 8 years ago

#5469 closed (worksforme)

Document difference in cleaning between initial and data parameter when using dynamic initial parameters

Reported by: msaelices Owned by: msaelices
Component: Documentation Version: master
Severity: Keywords: newforms, sprintsept14
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


I think is important to note that dynamic initial data created in a form is not cleaned, unlike data parameter. It could causes developer fails like caused by ticket #5145. This is an example what I refer:

    >>> class NewsForm(forms.Form):
    ...     date = forms.DateField()
    ...     title = forms.CharField()
    >>> f = NewsForm(initial={'date': 'not_a_date'})
    >>> f.as_table()
    <tr><th><label for="id_date">Date:</label></th><td><input type="text" name="date" value="not_a_date" id="id_date" /></td></tr>
    <tr><th><label for="id_title">Title:</label></th><td><input type="text" name="title" id="id_title" /></td></tr>

Attachments (2)

newforms_docs.diff (1.1 KB) - added by msaelices 9 years ago.
Documentation patch
docs_newforms_txt.diff (1.4 KB) - added by Nis Jørgensen <nis@…> 9 years ago.
I merged my own docs from 5145 into the ones in the previous page.

Download all attachments as: .zip

Change History (7)

Changed 9 years ago by msaelices

Documentation patch

comment:1 Changed 9 years ago by msaelices

  • Keywords sprintsept14 added
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

Changed 9 years ago by Nis Jørgensen <nis@…>

I merged my own docs from 5145 into the ones in the previous page.

comment:2 Changed 9 years ago by Nis Jørgensen <nis@…>

I updated with a sentence specific to 5145.

comment:3 Changed 9 years ago by msaelices

Mmmm... I think your last sentence could be confusing for the user, because he doesn't know what is a MultiValued (docs has not written yet and besides his location is after this).

comment:4 Changed 9 years ago by ubernostrum

  • Triage Stage changed from Unreviewed to Accepted

comment:5 Changed 8 years ago by ubernostrum

  • Resolution set to worksforme
  • Status changed from new to closed

The current docs explain this and actually use initial as an example of a way to supply data which bypasses validation.

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