On Mon, 2006-07-03 at 10:33 +0000, ama55 wrote:
> Hi:
> I have 2 tables in the database user and person, there is a 1-1
> relation between these tables. i am designing my own pages and adding
> the person and users to the database using addmanipulator. when
> creating the user i want to assign it to an existing person. i am
> passing the person_id using the url.
> all i want to know is how to assign my user to an existing person in
> the view class.

Do you actually have a OneToOneField in your model or are you just
keeping the primary key fields in sync manually?

In the former case, just assign the related object to the attribute. For
example,

        user.person = person_instance
        
should work.

In the latter case, you can specify the primary key value for the new
user at creation time (see
http://www.djangoproject.com/documentation/db_api/#explicitly-specifying-auto-primary-key-values)

Regards,
Malcolm



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