diff --git a/django/newforms/__init__.py b/django/newforms/__init__.py index f0eca9a950..9d12c55ae9 100644 --- a/django/newforms/__init__.py +++ b/django/newforms/__init__.py @@ -3,7 +3,6 @@ Django validation and HTML form handling. TODO: Validation not tied to a particular field - ' >>> f['message'].as_text() u'' +For a form with a + + + +>>> f = FrameworkForm({'name': 'Django', 'language': 'P'}) +>>> print f['language'] + + +MultipleChoiceField is a special case, as its data is required to be a list: +>>> class SongForm(Form): +... name = CharField() +... composers = MultipleChoiceField() +>>> f = SongForm() +>>> print f['composers'] + +>>> class SongForm(Form): +... name = CharField() +... composers = MultipleChoiceField(choices=[('J', 'John Lennon'), ('P', 'Paul McCartney')]) +>>> f = SongForm() +>>> print f['composers'] + +>>> f = SongForm({'name': 'Yesterday', 'composers': ['P']}) +>>> print f['name'] + +>>> print f['composers'] + """ if __name__ == "__main__":