# Index views
* refactors index view methods into classes * introduces AbstractIndexView as base class
This commit is contained in:
23
konova/views/index.py
Normal file
23
konova/views/index.py
Normal file
@@ -0,0 +1,23 @@
|
||||
"""
|
||||
Author: Michel Peltriaux
|
||||
Created on: 14.12.25
|
||||
|
||||
"""
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||
from django.utils.decorators import method_decorator
|
||||
from django.views import View
|
||||
|
||||
from konova.decorators import any_group_check
|
||||
|
||||
|
||||
class AbstractIndexView(LoginRequiredMixin, View):
|
||||
_TEMPLATE = "generic_index.html"
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
||||
@method_decorator(login_required)
|
||||
@method_decorator(any_group_check)
|
||||
def dispatch(self, request, *args, **kwargs):
|
||||
return super().dispatch(request, *args, **kwargs)
|
||||
Reference in New Issue
Block a user