46 lines
1.5 KiB
Python
46 lines
1.5 KiB
Python
from django.conf import settings
|
|
from django.urls import reverse_lazy
|
|
|
|
from core.models.brands import Brand
|
|
from core.views.generic import BackendListView, BackendUpdateView, BackendDeleteView, BackendCreateView
|
|
|
|
class BrandListView(BackendListView):
|
|
template_name = f"{settings.EXPEPHALON_BACKEND}/brands/index.html"
|
|
model = Brand
|
|
|
|
def get_context_data(self, **kwargs):
|
|
context = super().get_context_data(**kwargs)
|
|
context["title"] = "Brand Settings"
|
|
return context
|
|
|
|
class BrandEditView(BackendUpdateView):
|
|
template_name = f"{settings.EXPEPHALON_BACKEND}/brands/update.html"
|
|
model = Brand
|
|
success_url = reverse_lazy("dbsettings")
|
|
fields = ["key", "value"]
|
|
|
|
def get_context_data(self, **kwargs):
|
|
context = super().get_context_data(**kwargs)
|
|
context["title"] = "Edit Brand"
|
|
return context
|
|
|
|
class BrandDeleteView(BackendDeleteView):
|
|
template_name = f"{settings.EXPEPHALON_BACKEND}/brands/delete.html"
|
|
model = Brand
|
|
success_url = reverse_lazy("dbsettings")
|
|
|
|
def get_context_data(self, **kwargs):
|
|
context = super().get_context_data(**kwargs)
|
|
context["title"] = "Delete Brand"
|
|
return context
|
|
|
|
class BrandCreateView(BackendCreateView):
|
|
template_name = f"{settings.EXPEPHALON_BACKEND}/dbsettings/create.html"
|
|
model = Brand
|
|
success_url = reverse_lazy("dbsettings")
|
|
fields = ["key", "value"]
|
|
|
|
def get_context_data(self, **kwargs):
|
|
context = super().get_context_data(**kwargs)
|
|
context["title"] = "Create Brand"
|
|
return context
|