Monday, August 30, 2010

How to display the user profile in the admin interface?

I have a company model

class Company(models.Model):
name = models.CharField(max_length=50)
address = models.TextField()
phone = models.CharField(max_length=15)
fax = models.CharField(max_length=15)

and I wanted to associate each user to a company, so I read
http://docs.djangoproject.com/en/dev/topics/auth/#storing-additional-information-about-users
added AUTH_PROFILE_MODULE = "myapp.UserProfile" to settings.py and
created a UserProfile model

class UserProfile(models.Model):
user = models.OneToOneField(User)
company = models.OneToOneField(Company)


How do I make it appear in the admin interface?

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

No comments:

Post a Comment