35 lines
872 B
Python
35 lines
872 B
Python
import uuid
|
|
|
|
from django.shortcuts import render
|
|
from django.views import View
|
|
from django.http import HttpResponseBadRequest
|
|
|
|
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 =
|
|
|
|
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)
|