Thank you for your suggestion!

I already done that, the problem is resolved for the moment using "through" 
for m2m model.

On Thursday, November 1, 2012 2:40:37 PM UTC+2, Nicolas Emiliani wrote:
>
>
>
> On Thu, Nov 1, 2012 at 6:29 AM, Zoltán Bege <begez...@gmail.com<javascript:>
> > 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)
>>
>>
> Hi, if you are using the Admin site contrib application you can do this :
>
>
> https://docs.djangoproject.com/en/dev/topics/auth/#adding-userprofile-fields-to-the-admin
>
> That way whenever you create a user, you'll have the inlined form that 
> belongs to 
> your user profile and you can simply check the is_admin checkbox.
>
>
> 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...@googlegroups.com<javascript:>
>> .
>> To unsubscribe from this group, send email to 
>> django-users...@googlegroups.com <javascript:>.
>> For more options, visit this group at 
>> http://groups.google.com/group/django-users?hl=en.
>>
>
>
>
> -- 
> Nicolas Emiliani
>
> Lo unico instantaneo en la vida es el cafe, y es bien feo.
>

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

Reply via email to