Answer the question
In order to leave comments, you need to log in
How to call a js script from a Django view in a template?
Under a certain condition, either a redirect is made from the view, or a pop-up needs to be called. The pop-up itself and the pop-up call function are defined in the template. How can such a thing be implemented?
For example:
@login_required
@api_view(['GET', 'POST'])
def client_authentication(request):
if request.method == 'POST':
return redirect('login')
if request.method == 'GET':
## здесь вызоваем скрипт определенный в шаблоне
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question