expephalon-kumisms/core/views/dbsettings.py
Klaus-Uwe Mitterer 53780751d1 Preparing files for admin profiles
Changing File models to allow user association
2020-04-16 15:22:03 +02:00

46 lines
1.5 KiB
Python

from django.conf import settings
from django.views.generic import ListView, UpdateView, DeleteView, CreateView
from django.urls import reverse_lazy
from dbsettings.models import Setting
class DBSettingsListView(ListView):
template_name = f"{settings.EXPEPHALON_BACKEND}/dbsettings/index.html"
model = Setting
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context["title"] = "Database Settings"
return context
class DBSettingsEditView(UpdateView):
template_name = f"{settings.EXPEPHALON_BACKEND}/dbsettings/update.html"
model = Setting
success_url = reverse_lazy("dbsettings")
fields = ["key", "value"]
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context["title"] = "Edit Setting"
return context
class DBSettingsDeleteView(DeleteView):
template_name = f"{settings.EXPEPHALON_BACKEND}/dbsettings/delete.html"
model = Setting
success_url = reverse_lazy("dbsettings")
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context["title"] = "Delete Setting"
return context
class DBSettingsCreateView(CreateView):
template_name = f"{settings.EXPEPHALON_BACKEND}/dbsettings/create.html"
model = Setting
success_url = reverse_lazy("dbsettings")
fields = ["key", "value"]
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context["title"] = "Create Setting"
return context