Monday, August 30, 2010

Re: How to display the user profile in the admin interface?

Hi João,

Add myapp.UserProfile to the INSTALLED_APPS global variable of your settings.py file, and in your admin.py file, import the model/s.

On Mon, Aug 30, 2010 at 5:04 PM, João Rodrigues <jvrodrigues@gmail.com> wrote:
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.




--
Regards,
Sithembewena Lloyd Dube
http://www.lloyddube.com

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