I asked a very similar question to this one yesterday and Alice has replied:
http://groups.google.com/group/django-users/browse_thread/thread/0350bdceec7d52d0/54af4cff81b20b32#54af4cff81b20b32 Please take a look at my reply in that post. I think both topics are awefully similar, should we simply "close" my post and discuss in here instead? -Roberto. On 1/8/06, oggie rob <[EMAIL PROTECTED]> wrote: > > > The problem is I can't figure out > how to detect that extra data without adding some indication in the > Items table as to what other table(s) to check in. Or I could check all > specialized tables, which is clunky. > > There may be some way to find out using introspection. You have the > _meta.fields list available for doing so - you could possibly look at > all non-null OneToOne fields and display the extra data in your model: > def get_all_fkey_reps(self): > from django.core.meta import fields > foreignkeys = [f for f in self._meta.fields if str(f.__class__) > == str(fields.ForeignKey)] > for key in foreignkeys: > if getattr(self, key.attname): > print repr(getattr(self, 'get_%s' % (key.name))()) > > This was just for debugging though - in your case you probably just > want to return the first non-null object. > > -rob > >

