Kaydet (Commit) 57169899 authored tarafından Nick Martini's avatar Nick Martini

fixing modelforms example code, ticket #18832

üst b7d3b057
......@@ -311,18 +311,18 @@ model fields:
to exclude from the form.
For example, if you want a form for the ``Author`` model (defined
above) that includes only the ``name`` and ``title`` fields, you would
above) that includes only the ``name`` and ``birth_date`` fields, you would
specify ``fields`` or ``exclude`` like this::
class PartialAuthorForm(ModelForm):
class Meta:
model = Author
fields = ('name', 'title')
fields = ('name', 'birth_date')
class PartialAuthorForm(ModelForm):
class Meta:
model = Author
exclude = ('birth_date',)
exclude = ('title',)
Since the Author model has only 3 fields, 'name', 'title', and
'birth_date', the forms above will contain exactly the same fields.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment