Hi All

To maintain a 1-1 relation with User table I have defined the
following in my models


class UserDetails(models.Model):
        user_id = models.OneToOneField(User, primary_key=True,
parent_link=True)
        choices= models.PositiveSmallIntegerField(null=False,
blank=False, choices=menu_filler(choice_list))

My query is : Inorder to enforce/ensure that a one to one relation
w.r.t UserDetails/User records exists
which of the following is a better practise and why

1.) Override the Save method in Class UserDetails:
like

def save():
   #create the user
   #create the userdetails

2.) Write a method in extendedmanager of UserDetails
like

class MyManager()
   # create the user
   # create the record


class UserDetails():
    objects=MyManager()


Thanks in advance

Regards
Subramanyam
--~--~---------~--~----~------------~-------~--~----~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to