I've got a Topic model, which is a bit like a category. Then there are  
TopicItem objects, which have a foreign key to a Topic, and a generic  
foreign key to anything else in the website, so that I can attach  
anything to a particular Topic. In my admin site, a few models have a  
generic inline formset for TopicItems, for conveniences' sake (all  
that work quite nicely, thanks to whoever developed that), and then  
the Topics themselves each display theirTopicItems via plain old  
inline formsets.

My question is, how do the TopicItems appearing on the Topics page  
determine their heading? At the bottom of each Topic page there's a  
"Topic Items" section, and each item within that section has a little  
heading reading "Topic item: None". I don't want it to say "None",  
obviously, I want it to produce the unicode method of the object  
that's connected (via generic foreign key) to that TopicItem. The  
TopicItem __unicode__ method looks like this:

def __unicode__(self):
   return unicode(self.content_object)

This works great in the shell: if I print a TopicItem, it prints the  
unicode method of its related object. But in the admin it's mostly  
None. Except for in *one* case, where one instance of one model  
produces the correct title. Everything else is still None. So clearly  
this is confusing. I can't see anything special about that one  
instance of that one model, and I can't (despite lengthy poking)  
actually figures out from where in the source code this particular  
value arises. Can someone just point me to a file and line number? Or  
otherwise clarify this?

Many thanks in advance,

Eric

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to