Files
django-htmx-presenatation/project/main/views/demo_view_base.py
Eden Kirin ae2612cfd6 Views
2024-04-06 12:16:22 +02:00

21 lines
581 B
Python

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)