diff options
| author | Russell Keith-Magee <russell@keith-magee.com> | 2011-02-26 12:49:00 +0000 |
|---|---|---|
| committer | Russell Keith-Magee <russell@keith-magee.com> | 2011-02-26 12:49:00 +0000 |
| commit | 3a3102378312e2eaf4d220e46984b705bae0877b (patch) | |
| tree | f8d68e721563db4b04c3976d28fcf9dd5b1ec96d | |
| parent | 049b3ff8a25a3907e7791091cb6a87910cff95df (diff) | |
[1.2.X] Fixed #11447 -- Ensured that ForeignKey widgets in a list-editable admin changelist won't wrap split the widget. Thanks to patrick@vonautomatisch.at for the report, and Julien Phalip for the patch.
Backport of r15656 from trunk.
git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@15658 bcc190cf-cafb-0310-a4f2-bffc1f526a37
| -rw-r--r-- | django/contrib/admin/templatetags/admin_list.py | 4 | ||||
| -rw-r--r-- | tests/regressiontests/admin_changelist/tests.py | 4 |
2 files changed, 5 insertions, 3 deletions
diff --git a/django/contrib/admin/templatetags/admin_list.py b/django/contrib/admin/templatetags/admin_list.py index 4e777ff1f0..6311c954f6 100644 --- a/django/contrib/admin/templatetags/admin_list.py +++ b/django/contrib/admin/templatetags/admin_list.py @@ -164,7 +164,9 @@ def items_for_result(cl, result, form): result_repr = escape(field_val) else: result_repr = display_for_field(value, f) - if isinstance(f, models.DateField) or isinstance(f, models.TimeField): + if isinstance(f, models.DateField)\ + or isinstance(f, models.TimeField)\ + or isinstance(f, models.ForeignKey): row_class = ' class="nowrap"' if force_unicode(result_repr) == '': result_repr = mark_safe(' ') diff --git a/tests/regressiontests/admin_changelist/tests.py b/tests/regressiontests/admin_changelist/tests.py index 9bb3aedb3d..e3b21ad925 100644 --- a/tests/regressiontests/admin_changelist/tests.py +++ b/tests/regressiontests/admin_changelist/tests.py @@ -32,7 +32,7 @@ class ChangeListTests(TransactionTestCase): template = Template('{% load admin_list %}{% spaceless %}{% result_list cl %}{% endspaceless %}') context = Context({'cl': cl}) table_output = template.render(context) - row_html = '<tbody><tr class="row1"><td class="action-checkbox"><input type="checkbox" class="action-select" value="1" name="_selected_action" /></td><th><a href="1/">name</a></th><td>(None)</td></tr></tbody>' + row_html = '<tbody><tr class="row1"><td class="action-checkbox"><input type="checkbox" class="action-select" value="1" name="_selected_action" /></td><th><a href="1/">name</a></th><td class="nowrap">(None)</td></tr></tbody>' self.assertFalse(table_output.find(row_html) == -1, 'Failed to find expected row element: %s' % table_output) @@ -53,7 +53,7 @@ class ChangeListTests(TransactionTestCase): template = Template('{% load admin_list %}{% spaceless %}{% result_list cl %}{% endspaceless %}') context = Context({'cl': cl}) table_output = template.render(context) - row_html = '<tbody><tr class="row1"><td class="action-checkbox"><input type="checkbox" class="action-select" value="1" name="_selected_action" /></td><th><a href="1/">name</a></th><td>Parent object</td></tr></tbody>' + row_html = '<tbody><tr class="row1"><td class="action-checkbox"><input type="checkbox" class="action-select" value="1" name="_selected_action" /></td><th><a href="1/">name</a></th><td class="nowrap">Parent object</td></tr></tbody>' self.assertFalse(table_output.find(row_html) == -1, 'Failed to find expected row element: %s' % table_output) |
