Opened 15 years ago
Last modified 10 years ago
#13664 new New feature
Enable admin permission checks from outside the ModelAdmin
Reported by: | Sebastian Noack | Owned by: | nobody |
---|---|---|---|
Component: | contrib.admin | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | yes |
Needs tests: | yes | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Pull Requests: | How to create a pull request | ||
Description ¶
At the moment there is no clean and convinient way to check for the admin permissions of a model from outside its ModelAdmin class. But for example, when I link from one model's admin to onther models's admin changelist, It would be good pratice to check first if the logged in user has the change permission for the other model. So it would be nice if the AdminSite, which is accessible from all ModelAdmin classes has methods to check those permissions for the admin of a given model. My patch adds the has_*_permission() methods from the ModelAdmin class also to the AdminSite class. But those methods in the AdminSite class takes also a model (or a string in the form 'app_label.model_name') and forwards the call to the corresponding method on the given models's admin class.
According to the ticket's flags, the next step(s) to move this issue forward are:
- To add tests to the patch, then uncheck the "Needs tests" flag on the ticket.
- To write documentation for the patch, then uncheck "Needs documentation" on the ticket.
If creating a new pull request, include a link to the pull request in the ticket comment when making that update. The usual format is:
[https://github.com/django/django/pull/#### PR]
.
Change History (6)
by , 15 years ago
Attachment: | add_permission_checks_to_admin_site.patch added |
---|
comment:1 by , 15 years ago
Needs documentation: | set |
---|---|
Needs tests: | set |
Triage Stage: | Unreviewed → Accepted |
comment:2 by , 14 years ago
Severity: | → Normal |
---|---|
Type: | → New feature |
comment:3 by , 13 years ago
UI/UX: | unset |
---|
comment:5 by , 10 years ago
Summary: | Enable admin permission checks from outside the ModelAdmin [PATCH] → Enable admin permission checks from outside the ModelAdmin |
---|---|
Version: | 1.2 → master |
Change UI/UX from NULL to False.