Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #11447 -- Ensured that ForeignKey widgets in a list-editable ad…

…min changelist won't wrap split the widget. Thanks to patrick@vonautomatisch.at for the report, and Julien Phalip for the patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@15656 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 0b53d318ef29a34afdb4ecca1c50641760a525eb 1 parent e5dfc6c
Russell Keith-Magee authored
4  django/contrib/admin/templatetags/admin_list.py
@@ -163,7 +163,9 @@ def items_for_result(cl, result, form):
163 163
                         result_repr = escape(field_val)
164 164
                 else:
165 165
                     result_repr = display_for_field(value, f)
166  
-                if isinstance(f, models.DateField) or isinstance(f, models.TimeField):
  166
+                if isinstance(f, models.DateField)\
  167
+                or isinstance(f, models.TimeField)\
  168
+                or isinstance(f, models.ForeignKey):
167 169
                     row_class = ' class="nowrap"'
168 170
         if force_unicode(result_repr) == '':
169 171
             result_repr = mark_safe(' ')
4  tests/regressiontests/admin_changelist/tests.py
@@ -36,7 +36,7 @@ def test_result_list_empty_changelist_value(self):
36 36
         template = Template('{% load admin_list %}{% spaceless %}{% result_list cl %}{% endspaceless %}')
37 37
         context = Context({'cl': cl})
38 38
         table_output = template.render(context)
39  
-        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>'
  39
+        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>'
40 40
         self.assertFalse(table_output.find(row_html) == -1,
41 41
             'Failed to find expected row element: %s' % table_output)
42 42
 
@@ -57,7 +57,7 @@ def test_result_list_html(self):
57 57
         template = Template('{% load admin_list %}{% spaceless %}{% result_list cl %}{% endspaceless %}')
58 58
         context = Context({'cl': cl})
59 59
         table_output = template.render(context)
60  
-        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>'
  60
+        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>'
61 61
         self.assertFalse(table_output.find(row_html) == -1,
62 62
             'Failed to find expected row element: %s' % table_output)
63 63
 

0 notes on commit 0b53d31

Please sign in to comment.
Something went wrong with that request. Please try again.