4

I'm using Django 1.4 and experiencing an unusual problem with hidden rows in my admin site.

I can view individual models in my app, and they appear to be querying the database correctly when I click into each one; I can see the number of matches in the top left corner ("3 locations" below my actions bar, for example). However, entries do not appear below that count.

enter image description here

If I try to open an entry directly using the URL, I also get a blank page.

I haven't customized the templates or css. Anyone have experience with this type of problem?

Update: if foreign keys are removed in the model, the entries reappear below the counts. However, that FK field is needed so still trying to identify the root cause.

  • 1
    Have you been changing CSS, HTML or applied anything specific in models or implemented own per-object permissions etc.? – Tadeck Jun 19 '12 at 22:48

3 Answers3

8

Fixed. This appears to happen when the model uses a ForeignKey field, and the table it points to does not have its data loaded. That accounts for the model seeing the number of rows, but not being able to pull up the individual entries.

1

I had this same issue (i.e. I could see the model count in the admin, but not the actual records).

I have a model (Category) with a ForeignKey to another model (Competition). I looked in the database and somewhere along the line while doing some code refactoring on the models and migrations, I ended up with the FKs on the Categories pointing to a non-existent Competition.

When I updated these FKs in the database, the records reappeared in the admin.

shawn
  • 3,922
  • 1
  • 17
  • 9
-1

In admin.py where you use foreign key you have to add at the last _id for example my foreign key I'd is iClientId so in admin.py we have to write in list_display iClientId_id.

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jan 21 '22 at 13:22