mirror of
https://github.com/Southampton-RSG/breccia-mapper.git
synced 2026-03-03 11:27:09 +00:00
[FEAT] Limit Map and Network views to admins
This commit is contained in:
@@ -1,21 +1,16 @@
|
||||
import csv
|
||||
import typing
|
||||
|
||||
from django.contrib.auth.mixins import UserPassesTestMixin
|
||||
from django.http import HttpResponse
|
||||
from django.views.generic import TemplateView
|
||||
from django.views.generic.list import BaseListView
|
||||
from breccia_mapper.views import UserIsStaffMixin
|
||||
|
||||
|
||||
class QuotedCsv(csv.excel):
|
||||
quoting = csv.QUOTE_NONNUMERIC
|
||||
|
||||
|
||||
class UserIsStaffMixin(UserPassesTestMixin):
|
||||
def test_func(self) -> typing.Optional[bool]:
|
||||
return self.request.user.is_staff
|
||||
|
||||
|
||||
class CsvExportView(UserIsStaffMixin, BaseListView):
|
||||
model = None
|
||||
serializer_class = None
|
||||
|
||||
Reference in New Issue
Block a user