Views
This commit is contained in:
20
project/main/views/demo_view_base.py
Normal file
20
project/main/views/demo_view_base.py
Normal file
@ -0,0 +1,20 @@
|
||||
from typing import Any
|
||||
|
||||
from django.core.handlers.wsgi import WSGIRequest
|
||||
from django.http import HttpResponse
|
||||
from django.views.generic import TemplateView
|
||||
|
||||
|
||||
class DemoViewBase(TemplateView):
|
||||
active_section = None
|
||||
title = None
|
||||
|
||||
def get_context_data(self, **kwargs) -> dict[str, Any]:
|
||||
return {
|
||||
"title": self.title,
|
||||
"active_section": self.active_section,
|
||||
}
|
||||
|
||||
def get(self, request: WSGIRequest, *args, **kwargs) -> HttpResponse:
|
||||
context = self.get_context_data(**kwargs)
|
||||
return self.render_to_response(context)
|
||||
Reference in New Issue
Block a user