I created an accounts app in my project, I 'd like to extend users to be able to work with one or more partners. I need to define one or more admin user for every partner.
This is my accounts/models.py. In this case is_admin is set globally for all partners, how do I have to set is_admin differently for every partner?
class UserProfile(models.Model):
partners = models.ManyToManyField('partners.Partner', null = True, blank = True)
user = models.OneToOneField(User)
is_admin = models.BooleanField(default = False)
def __unicode__(self):
return self.partners
def create_user_profile(sender, instance, created, **kwargs):
if created:
UserProfile.objects.create(user = instance)
post_save.connect(create_user_profile, sender = User)
Thanks!
--
Zoltán Bege
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/x4UAl7Mc-w8J.
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.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment