You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
842 B
Python

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)