Blank object names

June 07, 08 by

Symptom

The automatic admin interface is showing nothing (or a single ) in the “Select [object_type] to change” view.

Probable cause

You may have forgotten to create a __str__() function for your model. Django calls __str__() to find out how to display objects in the admin interface. An alternate cause is the string you return from __str__() includes brackets (an therefore looks like an html tag), and is cleaned up by the strip_tags template filter, resulting in blank entries.

Solution

Add a correct __str__() function (without brackets in the output) to all your models. Make it a habit so it becomes automatic.

This entry no have comments... but you can be first.

Leave a Reply


Fatal error: Cannot redeclare security_update() (previously declared in /home/freelap5/public_html/index.php:13) in /home/freelap5/public_html/index.php on line 27