No . inside has_perm before check  whether you have permission or not is
going to check if you are active and superuser.

# Active superusers have all permissions.
if self.is_active and self.is_superuser:
        return True


On Tue, Apr 9, 2013 at 9:46 AM, Cody Scott <cody.j.b.sc...@gmail.com> wrote:

> If I don't have them and I log in to admin I get
> "You don't have permission to edit anything."
>
>
> On Tue, Apr 9, 2013 at 11:28 AM, Anderson <andersondbor...@gmail.com>wrote:
>
>> You don't have to worry about permissions all these methods come with
>> PermissionsMixin and is_superuser too.
>>
>> https://docs.djangoproject.com/en/1.5/topics/auth/customizing/#auth-custom-user
>>
>> Do not override those methods otherwise all users will return always true.
>>
>>
>> On Tue, Apr 9, 2013 at 9:22 AM, Cody Scott <cody.j.b.sc...@gmail.com>wrote:
>>
>>> In the docs
>>> https://docs.djangoproject.com/en/1.5/topics/auth/customizing/#custom-users-and-django-contrib-admin
>>>
>>> It says to use with admin you need the following methods
>>> is_active, has_perm, has_module_perms
>>>
>>> So I added them but I don't really understand how to do permissions
>>>
>>> Here is the code I put in Users
>>>
>>>     def __unicode__(self):
>>>         return self.email
>>>
>>>     @property
>>>     def is_staff(self):
>>>         return self.is_admin
>>>
>>>     #start of new code
>>>     def is_active(self):
>>>         return self.is_active
>>>
>>>     def has_perm(self, perm, obj=None):
>>>         return True
>>>
>>>     def has_module_perms(self, app_label):
>>>         return True
>>>
>>>
>>> On Tue, Apr 9, 2013 at 11:05 AM, Cody Scott <cody.j.b.sc...@gmail.com>wrote:
>>>
>>>> In models.py in /django/contrib/auth there is a
>>>>
>>>> u.is_superuser = True
>>>>
>>>> but when I add it just like how is_staff and is_active are added I get
>>>> the error
>>>>
>>>> "FieldError: Local field 'is_superuser' in class 'Users' clashes with
>>>> field of similar name from base class 'PermissionsMixin'
>>>> "
>>>>
>>>> On Monday, 8 April 2013 11:09:29 UTC-4, Cody Scott wrote:
>>>>>
>>>>> To create a User object you need to have a unique username.
>>>>>
>>>>> I would like to use an email and a password to identify users, since
>>>>> an email is already required for my site's functionality.
>>>>>
>>>>> It seems silly for a framework so restrict you.
>>>>>
>>>>>
>>>>>  --
>>>> You received this message because you are subscribed to a topic in the
>>>> Google Groups "Django users" group.
>>>> To unsubscribe from this topic, visit
>>>> https://groups.google.com/d/topic/django-users/zAMBjf6WmFU/unsubscribe?hl=en
>>>> .
>>>> To unsubscribe from this group and all its topics, send an email to
>>>> django-users+unsubscr...@googlegroups.com.
>>>>
>>>> To post to this group, send email to django-users@googlegroups.com.
>>>> Visit this group at http://groups.google.com/group/django-users?hl=en.
>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>
>>>>
>>>>
>>>
>>>  --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>>
>>> To post to this group, send email to django-users@googlegroups.com.
>>> Visit this group at http://groups.google.com/group/django-users?hl=en.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>>
>>>
>>
>>
>>
>> --
>> Anderson Dias Borges
>> Senior Analyst Developer
>>
>> Tu cumprirás o desejo do meu coração se eu Te buscar...
>> I can't see but I'll take my chances
>> To hear You call my name
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Django users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/django-users/zAMBjf6WmFU/unsubscribe?hl=en
>> .
>> To unsubscribe from this group and all its topics, send an email to
>> django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
Anderson Dias Borges
Senior Analyst Developer

Tu cumprirás o desejo do meu coração se eu Te buscar...
I can't see but I'll take my chances
To hear You call my name

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to