Views
This commit is contained in:
@ -1 +1,6 @@
|
||||
from .complex_form import ComplexFormView
|
||||
from .filter_list import FilterListView
|
||||
from .form_validation import FormValidationView
|
||||
from .home import HomeView
|
||||
from .swap_content import SwapContentView
|
||||
from .table_inline_edit import TableInlineEditView
|
||||
|
||||
7
project/main/views/complex_form.py
Normal file
7
project/main/views/complex_form.py
Normal file
@ -0,0 +1,7 @@
|
||||
from project.main.views.demo_view_base import DemoViewBase
|
||||
|
||||
|
||||
class ComplexFormView(DemoViewBase):
|
||||
template_name = "main/complex_form.html"
|
||||
active_section = "complex-form"
|
||||
title = "Complex Form"
|
||||
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)
|
||||
7
project/main/views/filter_list.py
Normal file
7
project/main/views/filter_list.py
Normal file
@ -0,0 +1,7 @@
|
||||
from project.main.views.demo_view_base import DemoViewBase
|
||||
|
||||
|
||||
class FilterListView(DemoViewBase):
|
||||
template_name = "main/filter_list.html"
|
||||
active_section = "filter-list"
|
||||
title = "Filter List"
|
||||
7
project/main/views/form_validation.py
Normal file
7
project/main/views/form_validation.py
Normal file
@ -0,0 +1,7 @@
|
||||
from project.main.views.demo_view_base import DemoViewBase
|
||||
|
||||
|
||||
class FormValidationView(DemoViewBase):
|
||||
template_name = "main/form_validation.html"
|
||||
active_section = "form-validation"
|
||||
title = "Form Validation"
|
||||
7
project/main/views/swap_content.py
Normal file
7
project/main/views/swap_content.py
Normal file
@ -0,0 +1,7 @@
|
||||
from project.main.views.demo_view_base import DemoViewBase
|
||||
|
||||
|
||||
class SwapContentView(DemoViewBase):
|
||||
template_name = "main/swap_content.html"
|
||||
active_section = "swap-content"
|
||||
title = "Swap Content"
|
||||
7
project/main/views/table_inline_edit.py
Normal file
7
project/main/views/table_inline_edit.py
Normal file
@ -0,0 +1,7 @@
|
||||
from project.main.views.demo_view_base import DemoViewBase
|
||||
|
||||
|
||||
class TableInlineEditView(DemoViewBase):
|
||||
template_name = "main/table_inline_edit.html"
|
||||
active_section = "table-inline-edit"
|
||||
title = "Table Inline Edit"
|
||||
Reference in New Issue
Block a user