mirror of
https://framagit.org/la-chariotte/la-chariotte.git
synced 2025-05-01 11:22:24 +02:00
13 lines
372 B
Python
13 lines
372 B
Python
from django.contrib.auth.mixins import UserPassesTestMixin
|
|
|
|
|
|
class UserCanAccessGroupedOrderOverviewMixin(UserPassesTestMixin):
|
|
"""
|
|
The view is accessible only if the request user is orga or superuser
|
|
"""
|
|
|
|
def test_func(self):
|
|
return (
|
|
self.get_object().orga == self.request.user
|
|
or self.request.user.is_superuser
|
|
)
|