Answer the question
In order to leave comments, you need to log in
What is the best way to redirect the user back with flash-message?
Hi all.
Essence: in the condition I check if the date range selected by the user intersects with the date range of the busy book. When the condition is met, I want to redirect to a page with a message about the need for correction.
I don't know what to choose. Confused between render, redirect, HttpResponse
Thanks in advance.
if not(endUser < startBook or startUser > endBook):
# they overlap
print("ОНИ ПЕРЕСЕКАЮТСЯ!")
.......
Answer the question
In order to leave comments, you need to log in
Use forms - if the form is wrong, then return to the same view where the form
render and redirect are located - shortcuts for HttpResponse and HttpRedirect
If in the console - that as sim3ks says. If you need to output to a template - read about django core app - messages
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question