# Public report
* refactors public report view methods into classes * introduces AbstractPublicReportView
This commit is contained in:
@@ -4,6 +4,7 @@ Created on: 14.12.25
|
||||
|
||||
"""
|
||||
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||
from django.http import HttpRequest, HttpResponse
|
||||
from django.utils.decorators import method_decorator
|
||||
from django.views import View
|
||||
|
||||
@@ -21,3 +22,5 @@ class AbstractDetailView(LoginRequiredMixin, View):
|
||||
def dispatch(self, request, *args, **kwargs):
|
||||
return super().dispatch(request, *args, **kwargs)
|
||||
|
||||
def get(self, request: HttpRequest, id: str, *args, **kwargs) -> HttpResponse:
|
||||
raise NotImplementedError()
|
||||
|
||||
@@ -4,6 +4,7 @@ Created on: 14.12.25
|
||||
|
||||
"""
|
||||
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||
from django.http import HttpRequest, HttpResponse
|
||||
from django.utils.decorators import method_decorator
|
||||
from django.views import View
|
||||
|
||||
@@ -19,3 +20,6 @@ class AbstractIndexView(LoginRequiredMixin, View):
|
||||
@method_decorator(any_group_check)
|
||||
def dispatch(self, request, *args, **kwargs):
|
||||
return super().dispatch(request, *args, **kwargs)
|
||||
|
||||
def get(self, request: HttpRequest, *args, **kwargs) -> HttpResponse:
|
||||
raise NotImplementedError()
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
"""
|
||||
Author: Michel Peltriaux
|
||||
Created on: 14.12.25
|
||||
|
||||
"""
|
||||
from abc import abstractmethod
|
||||
|
||||
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||
from django.http import HttpRequest, HttpResponse
|
||||
from django.utils.decorators import method_decorator
|
||||
from django.views import View
|
||||
|
||||
from konova.decorators import uuid_required
|
||||
|
||||
|
||||
class AbstractPublicReportView(LoginRequiredMixin, View):
|
||||
_TEMPLATE = None
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
|
||||
@method_decorator(uuid_required)
|
||||
def dispatch(self, request, *args, **kwargs):
|
||||
return super().dispatch(request, *args, **kwargs)
|
||||
|
||||
@abstractmethod
|
||||
def get(self, request: HttpRequest, id: str, *args, **kwargs) -> HttpResponse:
|
||||
raise NotImplementedError()
|
||||
Reference in New Issue
Block a user