1

I have a model with a bunch of fields, and after deploying to production, the django admin shows no fields for that specific model, like at all.

I see the top title "Change MODELNAME", and the bottom toolbar with the save buttons. But when i click save, i get a validation error, but still no fields.

I get no errors, it's just not showing.

The issue occurred after changing something unrelated in the database, and minor changes in the code. But from what i can see, nothing related to the admin.

Also the most weird part, it works when running locally using a local database (using postgres in both production and dev env).

Django version 1.11.6

enter image description here

EDIT:

It seems a "warning" was logged, and i only get emails on errors.... Found this in the log file.

django.template: Exception raised while rendering {% include %} for template 'admin/change_form.html'
Moulde
  • 3,438
  • 4
  • 29
  • 38
  • I get emails on all errors in django, and i hadn't gotten any emails, ie no errors. But i just found a warning in the django log, saying "django.template: Exception raised while rendering {% include %} for template 'admin/change_form.html'". So i have something to work with after all :) I wonder why that's a warning and not an error !? – Moulde Mar 07 '18 at 12:57

1 Answers1

1

Solved the issue.

I had model B (which was associated to my Device model) where the unicode method accidentally returned nothing, ie None, and the django admin form failed when it attempted to render the string representation of the model, inside the dropdown on the Device model - which makes the whole form fail when rendering.

That really should be an error, and not a warning IMO, as the rendering should not just use an empty string as fallback when it happens.

Moulde
  • 3,438
  • 4
  • 29
  • 38