On Thursday, November 1, 2012 11:29:38 AM UTC+2, Zoltán Bege wrote:
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/-/J0DJKVoy-wcJ.
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