Point templates to correct path

This commit is contained in:
Mark Veidemanis 2023-02-10 19:43:42 +00:00
parent 3962a4abb2
commit 5c10c92c2f
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
1 changed files with 12 additions and 12 deletions

View File

@ -34,7 +34,7 @@ class ObjectNameMixin(object):
class ObjectList(RestrictedViewMixin, ObjectNameMixin, ListView): class ObjectList(RestrictedViewMixin, ObjectNameMixin, ListView):
allowed_types = ["modal", "widget", "window", "page"] allowed_types = ["modal", "widget", "window", "page"]
window_content = "window-content/objects.html" window_content = "mixins/window-content/objects.html"
list_template = None list_template = None
page_title = None page_title = None
@ -66,7 +66,7 @@ class ObjectList(RestrictedViewMixin, ObjectNameMixin, ListView):
return self.object_list return self.object_list
allow_empty = self.get_allow_empty() allow_empty = self.get_allow_empty()
self.template_name = f"wm/{type}.html" self.template_name = f"mixins/wm/{type}.html"
unique = str(uuid.uuid4())[:8] unique = str(uuid.uuid4())[:8]
list_url_args = {} list_url_args = {}
@ -138,7 +138,7 @@ class ObjectList(RestrictedViewMixin, ObjectNameMixin, ListView):
class ObjectCreate(RestrictedViewMixin, ObjectNameMixin, CreateView): class ObjectCreate(RestrictedViewMixin, ObjectNameMixin, CreateView):
allowed_types = ["modal", "widget", "window", "page"] allowed_types = ["modal", "widget", "window", "page"]
window_content = "window-content/object-form.html" window_content = "mixins/window-content/object-form.html"
parser_classes = [FormParser] parser_classes = [FormParser]
page_title = None page_title = None
@ -191,7 +191,7 @@ class ObjectCreate(RestrictedViewMixin, ObjectNameMixin, CreateView):
return HttpResponseBadRequest("No type specified") return HttpResponseBadRequest("No type specified")
if type not in self.allowed_types: if type not in self.allowed_types:
return HttpResponseBadRequest("Invalid type specified") return HttpResponseBadRequest("Invalid type specified")
self.template_name = f"wm/{type}.html" self.template_name = f"mixins/wm/{type}.html"
unique = str(uuid.uuid4())[:8] unique = str(uuid.uuid4())[:8]
self.request = request self.request = request
@ -234,14 +234,14 @@ class ObjectCreate(RestrictedViewMixin, ObjectNameMixin, CreateView):
def post(self, request, *args, **kwargs): def post(self, request, *args, **kwargs):
self.request = request self.request = request
self.template_name = "partials/notify.html" self.template_name = "mixins/partials/notify.html"
return super().post(request, *args, **kwargs) return super().post(request, *args, **kwargs)
class ObjectRead(RestrictedViewMixin, ObjectNameMixin, DetailView): class ObjectRead(RestrictedViewMixin, ObjectNameMixin, DetailView):
allowed_types = ["modal", "widget", "window", "page"] allowed_types = ["modal", "widget", "window", "page"]
window_content = "window-content/object.html" window_content = "mixins/window-content/object.html"
detail_template = "partials/generic-detail.html" detail_template = "mixins/partials/generic-detail.html"
page_title = None page_title = None
page_subtitle = None page_subtitle = None
@ -261,7 +261,7 @@ class ObjectRead(RestrictedViewMixin, ObjectNameMixin, DetailView):
return HttpResponseBadRequest("No type specified") return HttpResponseBadRequest("No type specified")
if type not in self.allowed_types: if type not in self.allowed_types:
return HttpResponseBadRequest() return HttpResponseBadRequest()
self.template_name = f"wm/{type}.html" self.template_name = f"mixins/wm/{type}.html"
unique = str(uuid.uuid4())[:8] unique = str(uuid.uuid4())[:8]
detail_url_args = {} detail_url_args = {}
@ -314,7 +314,7 @@ class ObjectRead(RestrictedViewMixin, ObjectNameMixin, DetailView):
class ObjectUpdate(RestrictedViewMixin, ObjectNameMixin, UpdateView): class ObjectUpdate(RestrictedViewMixin, ObjectNameMixin, UpdateView):
allowed_types = ["modal", "widget", "window", "page"] allowed_types = ["modal", "widget", "window", "page"]
window_content = "window-content/object-form.html" window_content = "mixins/window-content/object-form.html"
parser_classes = [FormParser] parser_classes = [FormParser]
page_title = None page_title = None
@ -366,7 +366,7 @@ class ObjectUpdate(RestrictedViewMixin, ObjectNameMixin, UpdateView):
return HttpResponseBadRequest("No pk specified") return HttpResponseBadRequest("No pk specified")
if type not in self.allowed_types: if type not in self.allowed_types:
return HttpResponseBadRequest("Invalid type specified") return HttpResponseBadRequest("Invalid type specified")
self.template_name = f"wm/{type}.html" self.template_name = f"mixins/wm/{type}.html"
unique = str(uuid.uuid4())[:8] unique = str(uuid.uuid4())[:8]
if type == "widget": if type == "widget":
self.hide_cancel = True self.hide_cancel = True
@ -407,13 +407,13 @@ class ObjectUpdate(RestrictedViewMixin, ObjectNameMixin, UpdateView):
def post(self, request, *args, **kwargs): def post(self, request, *args, **kwargs):
self.request = request self.request = request
self.template_name = "partials/notify.html" self.template_name = "mixins/partials/notify.html"
return super().post(request, *args, **kwargs) return super().post(request, *args, **kwargs)
class ObjectDelete(RestrictedViewMixin, ObjectNameMixin, DeleteView): class ObjectDelete(RestrictedViewMixin, ObjectNameMixin, DeleteView):
model = None model = None
template_name = "partials/notify.html" template_name = "mixins/partials/notify.html"
# Overriden to prevent success URL from being used # Overriden to prevent success URL from being used
def delete(self, request, *args, **kwargs): def delete(self, request, *args, **kwargs):