https://docs.djangoproject.com/en/dev/ref/forms/api/
A list-like object that is displayed as an HTML <ul class="errorlist"> when printed:
>>> data = {'subject': 'hi', 'message': '', 'sender': '', 'cc_myself': ''}
>>> f = ContactForm(data, auto_id=False)
data var is as above.
- BoundField.value()
- New in Django 1.3: Please see the release notes
Use this method to render the raw value of this field as it would be rendered by a Widget:
>>> initial = {'subject': 'welcome'} >>> unbound_form = ContactForm(initial=initial) >>> bound_form = ContactForm(data, initial=initial) >>> print(unbound_form['subject'].value()) welcome >>> print(bound_form['subject'].value()) hi
unbound form
bound form takes argument dict "data".
No comments:
Post a Comment