I am need help in using async to python django in base class view.
class IndexPage(CreateView):
"""Page index site"""
async def post(self, request, *args, **kwargs) -> object:
await send_code(data['email'])
return render(request, 'activate.html')
return super().post(request, *args, **kwargs)
If you create this function simply as a function without a class, everything works fine, but an error occurs when using the class:
IndexPAge HTTP handlers must either be all sync or all async.
Please help anyone who has encountered this problem, thank you.
class Test(CreateView):
template_name = 'index.html'
form_class = TestForm
view_is_async = True # on async