0

Various other posts on stack have looked at how to "properly" include a foreignkey in list_display, which enables sorting, etc.

However, I am not interested in that. I just want to display the unicode of the foreignkey field.

From the django docs:

A few special cases to note about list_display:

If the field is a ForeignKey, Django will display the __unicode__() of the related object.

I had this working previously, but since I last checked the django admin, it is no longer displaying any entries at all if the list_display includes a foreignkey field. Once the foreignkey field is removed from list_display, the entries are once again displaying.

I obviously updated something minor that caused this. Any ideas?

4

1 回答 1

0

发现这可能是由于数据库问题将外键信息存储为空字符串。

由于我仍在开发中,我只是放弃了桌子。但是,我欢迎讨论和回答如何在不放弃表格的情况下解决这个问题。

Django admin List Display + ForeignKey = Empty Change List

于 2012-07-04T23:10:18.040 回答