Opened 10 years ago
Closed 10 years ago
#22952 closed Cleanup/optimization (duplicate)
add more detail to Django authentication system
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Documentation | Version: | 1.5 |
Severity: | Normal | Keywords: | permission |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
https://docs.djangoproject.com/en/1.5/topics/auth/default/
the Django authentication system document should add some more detail,I'm new to Django and stucked for the document.
in the Programmatically creating permissions section,it just tells:
The permission can then be assigned to a User via its user_permissions attribute or to a Group via its permissions attribute.
I think it add more more details ,because the document is a reference,more detail is better.
it should add some code to illustrate the usage,it still has some unconspicuous aspect.
it should add codes below:
user = authenticate(username='john', password='johnpassword')
user.user_permissions.add(permission) #now the custom permission has been added to the user,but now the perssion is not visible,if we user "user.get_all_permissions()" it is still same as before,if we want to see the custom perimission in the User,we should authenticate again
user = authenticate(username='john', password='johnpassword')
user.get_all_permissions() #now we will see the custom permission we add to the user
Thanks for the feedback. In version 1.6 and later of the docs, there's actually a section that follows which discusses permission caching.
If you are still using 1.5, I'd encourage you to upgrade soon as it won't receive security updates once 1.7 is released shortly.