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