Opened 17 years ago

Closed 17 years ago

#5469 closed (worksforme)

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

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

Description

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 Manuel Saelices 17 years ago.
Documentation patch
docs_newforms_txt.diff (1.4 KB ) - added by Nis Jørgensen <nis@…> 17 years ago.
I merged my own docs from 5145 into the ones in the previous page.

Download all attachments as: .zip

Change History (7)

by Manuel Saelices, 17 years ago

Attachment: newforms_docs.diff added

Documentation patch

comment:1 by Manuel Saelices, 17 years ago

Keywords: sprintsept14 added

by Nis Jørgensen <nis@…>, 17 years ago

Attachment: docs_newforms_txt.diff added

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

comment:2 by Nis Jørgensen <nis@…>, 17 years ago

I updated with a sentence specific to 5145.

comment:3 by Manuel Saelices, 17 years ago

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 by James Bennett, 17 years ago

Triage Stage: UnreviewedAccepted

comment:5 by James Bennett, 17 years ago

Resolution: worksforme
Status: newclosed

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