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

newforms-admin: Fixed #5828. You can leave inline add forms empty again. Thanks brosner.

git-svn-id: http://code.djangoproject.com/svn/django/branches/newforms-admin@6837 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Joseph Kocherhans
2007-12-02 18:14:11 +00:00
parent e4910ce5b7
commit b15703d322
3 changed files with 53 additions and 3 deletions

View File

@@ -292,6 +292,12 @@ checkboxes).
>>> w.value_from_datadict({}, {}, 'testing')
False
The CheckboxInput widget will always be empty when there is a False value
>>> w.is_empty(False)
True
>>> w.is_empty(True)
False
# Select Widget ###############################################################
>>> w = Select()
@@ -453,6 +459,15 @@ over multiple times without getting consumed:
<option value="3" selected="selected">No</option>
</select>
The NullBooleanSelect widget will always be empty when Unknown or No is selected
as its value. This is to stay compliant with the CheckboxInput behavior
>>> w.is_empty(False)
True
>>> w.is_empty(None)
True
>>> w.is_empty(True)
False
""" + \
r""" # [This concatenation is to keep the string below the jython's 32K limit].
# SelectMultiple Widget #######################################################
@@ -895,6 +910,16 @@ u'<input id="foo_0" type="text" class="big" value="john" name="name_0" /><br /><
>>> w.render('name', ['john', 'lennon'])
u'<input id="bar_0" type="text" class="big" value="john" name="name_0" /><br /><input id="bar_1" type="text" class="small" value="lennon" name="name_1" />'
The MultiWidget will be empty only when all widgets are considered empty.
>>> w.is_empty(['john', 'lennon'])
False
>>> w.is_empty(['john', ''])
False
>>> w.is_empty(['', ''])
True
>>> w.is_empty([None, None])
True
# SplitDateTimeWidget #########################################################
>>> w = SplitDateTimeWidget()