mirror of
https://github.com/django/django.git
synced 2025-11-01 12:25:37 +00:00
Added a way to iterate over hidden/visible fields in a form. Useful for manual
form layout. git-svn-id: http://code.djangoproject.com/svn/django/trunk@9569 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
dfef20a780
commit
bfab9d62ee
3 changed files with 77 additions and 1 deletions
|
|
@ -1757,4 +1757,16 @@ initial that returns False on a boolean call needs to be treated literally.
|
|||
>>> form.is_valid()
|
||||
True
|
||||
|
||||
# Extracting hidden and visible fields ######################################
|
||||
|
||||
>>> class SongForm(Form):
|
||||
... token = CharField(widget=HiddenInput)
|
||||
... artist = CharField()
|
||||
... name = CharField()
|
||||
>>> form = SongForm()
|
||||
>>> [f.name for f in form.hidden_fields()]
|
||||
['token']
|
||||
>>> [f.name for f in form.visible_fields()]
|
||||
['artist', 'name']
|
||||
|
||||
"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue