I have a custom 404 template for my whole django application but I would like to show a different one for specific views.
Is there a way to overrride the 404 template at runtime for one specific view?
I think this is what you want
def not_found404(request, exception):
data = {}
if request.path == "/spesific-view-path/":
return render(request, 'your_app/different_404.html', data)
return render(request,'your_app/404.html', data)
main urls.py
handler404 = 'your_app.views.not_found404'