Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
wrapped_view: typing.Callable[[HttpRequest], HttpResponse],
mapped_actions: typing.Optional[typing.Dict[str, str]] = None,
) -> Type[AsyncConsumer]:
"""
Wrap a django View so that it will be triggered by actions over this json
websocket consumer.
"""
if mapped_actions is None:
mapped_actions = {
"create": "PUT",
"update": "PATCH",
"list": "GET",
"retrieve": "GET",
}
class DjangoViewWrapper(DjangoViewAsConsumer):
view = wrapped_view
actions = mapped_actions
return DjangoViewWrapper