mirror of
https://github.com/django/django.git
synced 2025-08-04 19:08:28 +00:00
Fixed #10512 -- Corrected the handling of extra fields on a ModelForm. Thanks to Alex Gaynor for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10070 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
536ccd1134
commit
cf7a3fa7f0
2 changed files with 14 additions and 1 deletions
|
@ -1450,6 +1450,19 @@ ValidationError: [u'Select a valid choice. z is not one of the available choices
|
|||
>>> core.parent
|
||||
<Inventory: Pear>
|
||||
|
||||
>>> class CategoryForm(ModelForm):
|
||||
... description = forms.CharField()
|
||||
... class Meta:
|
||||
... model = Category
|
||||
... fields = ['description', 'url']
|
||||
|
||||
>>> CategoryForm.base_fields.keys()
|
||||
['description', 'url']
|
||||
|
||||
>>> print CategoryForm()
|
||||
<tr><th><label for="id_description">Description:</label></th><td><input type="text" name="description" id="id_description" /></td></tr>
|
||||
<tr><th><label for="id_url">The URL:</label></th><td><input id="id_url" type="text" name="url" maxlength="40" /></td></tr>
|
||||
|
||||
# Clean up
|
||||
>>> import shutil
|
||||
>>> shutil.rmtree(temp_storage_dir)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue