diff --git a/django/contrib/admin/templatetags/admin_list.py b/django/contrib/admin/templatetags/admin_list.py index 7d4d8cdc98..bbe4b649f5 100644 --- a/django/contrib/admin/templatetags/admin_list.py +++ b/django/contrib/admin/templatetags/admin_list.py @@ -163,7 +163,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 1f3cb5955a..b53d832752 100644 --- a/tests/regressiontests/admin_changelist/tests.py +++ b/tests/regressiontests/admin_changelist/tests.py @@ -36,7 +36,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 = '