On 12/1/06, scum <[EMAIL PROTECTED]> wrote: > > Trying to extend the user group using this model code: > > class UserProfile(models.Model): > user = models.ForeignKey(User, unique=True, > edit_inline=models.TABULAR, num_in_admin=1,min_num_in_admin=1, > max_num_in_admin=1,num_extra_on_change=0) > hours = models.FloatField( max_digits=8, decimal_places=2, default=0, > core=True) > > > In the shell, when I type: > >>> from django.contrib.auth.models import User > >>> a = User.objects.all()[0] > >>> a.get_profile() > Traceback (most recent call last): > ... > DoesNotExist: UserProfile matching query does not exist. > > > OK -- understood, because the userprofile table is empty. > > > >>> a = User() > >>> a.save() > >>> a.get_profile() > Traceback (most recent call last): > ... > DoesNotExist: UserProfile matching query does not exist. > > The Question: > How do I get the userprofile created with each user? (I tried the > OneToOne model and that didn't work either). > > Thanks!
James' blog post on it is more or less considered the one true way to do this: http://www.b-list.org/weblog/2006/06/06/django-tips-extending-user-model Jay P. --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---