Code

Ticket #11447: 11447_fk_nowrap.diff

File 11447_fk_nowrap.diff, 844 bytes (added by julien, 3 years ago)
Line 
1diff --git a/django/contrib/admin/templatetags/admin_list.py b/django/contrib/admin/templatetags/admin_list.py
2index 7d4d8cd..bbe4b64 100644
3--- a/django/contrib/admin/templatetags/admin_list.py
4+++ b/django/contrib/admin/templatetags/admin_list.py
5@@ -163,7 +163,9 @@ def items_for_result(cl, result, form):
6                         result_repr = escape(field_val)
7                 else:
8                     result_repr = display_for_field(value, f)
9-                if isinstance(f, models.DateField) or isinstance(f, models.TimeField):
10+                if isinstance(f, models.DateField)\
11+                or isinstance(f, models.TimeField)\
12+                or isinstance(f, models.ForeignKey):
13                     row_class = ' class="nowrap"'
14         if force_unicode(result_repr) == '':
15             result_repr = mark_safe(' ')