After rolling out my wife’s site, I decided to build two of my own - in Django, of course. I won’t get into what they are, but I created a data class (think database table) with a __repr__ attribute (I’ll get to what it’s for in a second) that looked like this:
def __repr__(self): return "%s" % (name)
Django’s database approach uses a data object’s __repr__ attribute to determine how it displays in the admin interface and in forms when you are taking advantage of all the Django-form-goodness-stuff . The particular class I defined the above __repr__ on has a “name” attribute, and I wanted the display value to be the object’s “name”. Clearly, I should have prefixed “name” with “self.”. Even though I was able to create a new record for this data type in the Django admin, this apparently kept the data from rendering in the admin interface and all I was getting was an error after creating the record. Now that I have my code fixed, I need to dig in a little bit and see if there is anything that Django could have done to make the error messages a little more helpful. Except for this little bump, due to my own stupidity, everything has been smooth sailing.