model_permissions.views
- class model_permissions.views.ObjPermLookupDict(user, app_label, obj=None)[source]
Bases:
django.contrib.auth.context_processors.PermLookupDict
Object permissions lookup dictionary.
- class model_permissions.views.ObjPermWrapper(user, obj=None)[source]
Bases:
django.contrib.auth.context_processors.PermWrapper
Object permissions wrapper to traverse a list of permissions.
- class model_permissions.views.PermissionContextMixin[source]
Bases:
object
View mixin to insert permissions in the template context.
If the get_context_data method is called and the context contains an ‘object’ element, this will insert a ‘object_perms’ permission wrapper.
The get_context_object_name method will be used too, if it exists.
- class model_permissions.views.RequirePermissionMixin[source]
Bases:
object
View mixin to require object permissions for access.
- required_permission = None
- get_required_permission_object(obj)[source]
Overwrite to check the required_permission against another model object.
- check_required_permission(permission_object)[source]
Check the required_permission on the given object.
- Raises
django.core.exceptions.PermissionDenied
if the current user does not have the required_permission.
- get_object(queryset=None)[source]
Get the object and check the required_permission on it.
- Raises
django.core.exceptions.PermissionDenied
if the current user does not have the required_permission.
- class model_permissions.views.PermissionMixin[source]
Bases:
model_permissions.views.RequirePermissionMixin
,model_permissions.views.PermissionContextMixin
View mixin to enable permissions.
- class model_permissions.views.DetailView(**kwargs)[source]
Bases:
model_permissions.views.PermissionMixin
,django.views.generic.detail.DetailView
DetailView with permissions.
- class model_permissions.views.UpdateView(**kwargs)[source]
Bases:
model_permissions.views.PermissionMixin
,django.views.generic.edit.UpdateView
UpdateView with permissions.
- class model_permissions.views.DeleteView(**kwargs)[source]
Bases:
model_permissions.views.PermissionMixin
,django.views.generic.edit.DeleteView
DeleteView with permissions.