forked from DGNum/gestioCOF
Restrict bds views to the staff
This commit is contained in:
parent
5d24786e20
commit
c52bac05b3
2 changed files with 8 additions and 2 deletions
5
bds/mixins.py
Normal file
5
bds/mixins.py
Normal file
|
@ -0,0 +1,5 @@
|
|||
from django.contrib.auth.mixins import PermissionRequiredMixin
|
||||
|
||||
|
||||
class StaffRequiredMixin(PermissionRequiredMixin):
|
||||
permission_required = "bds:is_team"
|
|
@ -2,9 +2,10 @@ from django.http import Http404
|
|||
from django.views.generic import TemplateView
|
||||
|
||||
from bds.autocomplete import bds_search
|
||||
from bds.mixins import StaffRequiredMixin
|
||||
|
||||
|
||||
class AutocompleteView(TemplateView):
|
||||
class AutocompleteView(StaffRequiredMixin, TemplateView):
|
||||
template_name = "bds/search_results.html"
|
||||
|
||||
def get_context_data(self, *args, **kwargs):
|
||||
|
@ -19,5 +20,5 @@ class AutocompleteView(TemplateView):
|
|||
return ctx
|
||||
|
||||
|
||||
class Home(TemplateView):
|
||||
class Home(StaffRequiredMixin, TemplateView):
|
||||
template_name = "bds/home.html"
|
||||
|
|
Loading…
Reference in a new issue