Hi there,

In my existing application, I have a user object/table to track all of our
users.  Users optionally have a foreign_info object with them too, if
they are foreigners.

So it's a one-to-one relationship.  Here's simplified:

class User:
    userbase_id = ... the primary key
    lots of other fields

class ForeignInfo:
    userbase_id = ... also primary key
    lots of other fields

My current goal is making the admin page look like I want it to, and I
want to be able to look at the foreign information while editing the user
object.

In my current framework, I had a functionality for a ForeignField, in the
User class, so the foreign fields simply appeared as fields in the User
object.  Is there a way to do that in django, something like:

class User:
    country_of_birth = ForeignField(ForeignInfo)
    passport_number = ForeignField(ForeignInfo)

So then it just gets the field from the other object.  Right now it just
seems that I can do:

    foreign_info = OneToOneField(ForeignInfo)

But then there's weirdness because it expects foreign_info_id to be the ID
field.  Is there a way to get around that, because that's a pretty huge
assumption??  For existing applications.

The difference between this and the Place/Restaurant example on the
website is that I never care solely about the ForeignInfo, it's only as
additional information to the "parent object" User.

And then how on the admin site do I make the foreign information editable
along with the User object?  I want it to look like the Poll/Choices
example in the tutorial, but that's of course with a one-many relation.
It can look like that but with num_in_admin=1.

I'm using the magic-removal branch.  Speaking of, does num_in_admin
work differently in that branch?

Thanks
Alan

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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