What is the purpose of adding `nowrap` class to all ForeignKey fields in django admin objects list?

452 views
Skip to first unread message

alTus

unread,
Dec 7, 2015, 8:33:34 AM12/7/15
to Django developers (Contributions to Django itself)
Django adds `nowrap` class to your `td` if you specify list_display to show any ForeignKey.
I can't see the purpose to do it. Any considerably long title breaks table layout hard.
Do I miss smth or may be it would be better to just remove it?

Tim Graham

unread,
Dec 7, 2015, 10:14:19 AM12/7/15
to Django developers (Contributions to Django itself)
Did you try looking through git blame to find the commit that added it?

https://github.com/django/django/commit/0b53d318 might be what you're looking for.

alTus

unread,
Dec 7, 2015, 11:52:23 AM12/7/15
to Django developers (Contributions to Django itself)
Didn't think about that way to investigate, thanks for the tip.
That commit says that it was added because list_editable FK widget would break into several line otherwise (same with date widgets).
Well, seems legit. But it's added even if the field is not in list_editable.
And now I start thinking that it's a bug rather than random issue.

понедельник, 7 декабря 2015 г., 18:14:19 UTC+3 пользователь Tim Graham написал:
Reply all
Reply to author
Forward
0 new messages