1
0
mirror of https://github.com/django/django.git synced 2025-10-24 14:16:09 +00:00

[1.0.X] Fixed #10792 -- Ensured that ModelChoiceFields don't provide an empty option when the underlying field has blank=False and there is a default value available. Thanks to carljm for the report and patch.

Merge of r10729 from trunk.

git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.0.X@10733 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Russell Keith-Magee
2009-05-11 00:01:40 +00:00
parent 0d930ee0e6
commit bc07a498fe
3 changed files with 34 additions and 1 deletions

View File

@@ -752,6 +752,10 @@ example::
# No empty label
field2 = forms.ModelChoiceField(queryset=..., empty_label=None)
Note that if a ``ModelChoiceField`` is required and has a default
initial value, no empty choice is created (regardless of the value
of ``empty_label``).
``ModelMultipleChoiceField``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~