mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +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:
@@ -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']
|
||||
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user