Hey there,

I have a django class Person which is obviously information on a person.
Then I have a relation class from Person<->Person that looks like this:

class Sponsorship(meta.Model):
  sponsored = meta.ForeignKey(Person, related_name='sponsor', core=True, 
edit_inline=meta.TABULAR)
  sponsor = meta.ForeignKey(Person, related_name='sponsored', core=True, 
edit_inline=meta.TABULAR)

  def __repr__(self):
    return(str(self.get_sponsor()) + '\'s sponsorship of ' + 
str(self.get_sp\onsored()))

  class META:
    admin = meta.Admin()

Pretty simple, eh?  Except for the fact that it relates the same object.
But when I try to view a Person object in admin (or try to create one), I
get a wonderful error message in the django error webpage:

KeyError at /admin/userbase/persons/2/
'Field sponsorship.0.sponsor not found\n[FormField "username", FormField
"name_title", FormField "name_preferred", FormField "home_line_1",
FormField "home_line_2", FormField "home_city", FormField "home_state",
FormField "home_zip", FormField "home_country", FormField "is_us_citizen",
FormField "is_account_administrator", FormField "is_account_approver",
FormField "is_admin", FormField "is_cracked", FormField "creation_date",
FormField "deactivation_date", FormField "account_type", FormField
"sponsorship.0.id", FormField "sponsorship.0.sponsored", FormField
"sponsorship.0.id", FormField "sponsorship.0.sponsored", FormField
"resourcerecord.0.id", FormField "resourcerecord.0.resource", FormField
"resourcerecord.0.status", FormField "resourcerecord.0.activation_date",
FormField "resourcerecord.0.username", FormField
"unixgroupmembership.0.id", FormField "unixgroupmembership.0.group",
FormField "unixgroupmembership.0.owner", FormField
"unixgroupmembership.0.default_group"]'

/usr/lib/python2.3/site-packages/Django-0.91-py2.3.egg/django/core/formfields.py
in __getitem__, line 26

It appears this is a list of the form fields, and the one for sponsor is
not getting in there, but I can see the sponsorship.sponsored ones in
there.

Further, if I rearrange the 'sponsor' and 'sponsored' lines in my class,
the opposite happens.  It tries to find sponsored but only stuff in there
is sponsor.

So it's not adding all the fields from the class to be displayed?

Hmmmmm.  Anyone have an idea?

Alan

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to