You should be able to handle this pretty easily with Django's built-in
permission system.

Just create a group, add the users to it, and assign the requisite
permissions to the group. Our add the needed permissions individually to
each user.

https://docs.djangoproject.com/en/1.7/topics/auth/default/#permissions-and-authorization

Then all you'll need to do is wrap your views with the correct permission
checks, or do the checks within the templates if you need to, like {% if
'foo.view' in perms %} assuming that you have the default context
processors in place, or have included the contrib.auth processor.

You shouldn't need to do any permission checks for pages that are available
to everyone.

Alternatively, you can tweak the user.is_staff attribute to True for those
that need extra access, and use that as your permission check if you don't
need anything fancy.

-James
On Feb 18, 2015 9:49 PM, "sum abiut" <[email protected]> wrote:

> Hi,
> I have an app that i am trying to allow only certain users to access
> specific views. For example all users can view the home page but for a
> certain link. i only want to allow the HR manager to access it.
>
> Could you please point me to right direction.
>
> Cheers
>
>
>  --
> 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 [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAPCf-y5VBRtsb2oFN5ZEPL2_57y%2BAhKqV-OnEqne2YAcACNxsw%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAPCf-y5VBRtsb2oFN5ZEPL2_57y%2BAhKqV-OnEqne2YAcACNxsw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciWj2mb4a0Yx1sep8X8MSdcLfNK_L8SJ04E29gkH10gjyA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to