import uuid from django.contrib.auth.mixins import LoginRequiredMixin from django.http import HttpResponseBadRequest from django.shortcuts import render from django.views import View class Hooks(LoginRequiredMixin, View): allowed_types = ["modal", "widget", "window", "page"] window_content = "window-content/hooks.html" async def get(self, request, type): if type not in self.allowed_types: return HttpResponseBadRequest template_name = f"wm/{type}.html" unique = str(uuid.uuid4())[:8] hooks = [{"user": "test", "hook": "/help22", "received": "40"}] context = { "title": f"{type} Demo", "unique": unique, "window_content": self.window_content, "hooks": hooks, } return render(request, template_name, context)