2022-10-13 14:26:43 +00:00
|
|
|
import uuid
|
|
|
|
|
|
|
|
from django.shortcuts import render
|
|
|
|
from django.views import View
|
2022-10-12 06:22:22 +00:00
|
|
|
from django.http import HttpResponseBadRequest
|
2022-10-13 14:26:43 +00:00
|
|
|
|
2022-10-12 06:22:22 +00:00
|
|
|
class OpenSettings(View):
|
|
|
|
allowed_types = ["modal", "widget", "window"]
|
|
|
|
|
|
|
|
async def get(self, request, type):
|
|
|
|
if type not in self.allowed_types:
|
|
|
|
return HttpResponseBadRequest
|
|
|
|
#template_name =
|
2022-10-13 14:26:43 +00:00
|
|
|
|
|
|
|
class DemoModal(View):
|
|
|
|
template_name = "modals/modal.html"
|
|
|
|
|
|
|
|
async def get(self, request):
|
|
|
|
return render(request, self.template_name)
|
|
|
|
|
|
|
|
|
|
|
|
class DemoWidget(View):
|
|
|
|
template_name = "widgets/widget.html"
|
|
|
|
|
|
|
|
async def get(self, request):
|
|
|
|
unique = str(uuid.uuid4())[:8]
|
|
|
|
return render(request, self.template_name, {"unique": unique})
|
|
|
|
|
|
|
|
|
|
|
|
class DemoWindow(View):
|
|
|
|
template_name = "windows/window.html"
|
|
|
|
|
|
|
|
async def get(self, request):
|
|
|
|
return render(request, self.template_name)
|