F
F
filmincer2016-05-21 19:44:16
Django
filmincer, 2016-05-21 19:44:16

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

2 answer(s)
S
sim3x, 2016-05-21
@filmincer

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

A
Alexey Ovdienko, 2016-05-23
@doubledare

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 question

Ask a Question

731 491 924 answers to any question