forked from openwisp/openwisp-controller
-
Notifications
You must be signed in to change notification settings - Fork 0
/
admin.py
28 lines (21 loc) · 726 Bytes
/
admin.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
"""
Base admin classes and mixins
"""
from django.core.exceptions import PermissionDenied
from openwisp_users.multitenancy import (
MultitenantAdminMixin as BaseMultitenantAdminMixin,
)
class OrgVersionMixin(object):
"""
Base VersionAdmin for openwisp_controller
"""
def recoverlist_view(self, request, extra_context=None):
""" only superusers are allowed to recover deleted objects """
if not request.user.is_superuser:
raise PermissionDenied
return super().recoverlist_view(request, extra_context)
class MultitenantAdminMixin(OrgVersionMixin, BaseMultitenantAdminMixin):
"""
openwisp_utils.admin.MultitenantAdminMixin + OrgVersionMixin
"""
pass