Opened 15 years ago
Last modified 9 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 |
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.
Attachments (1)
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 , 9 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.