django - Best Practice to handle form submission status pages reload -


i have django email form posts url in turn redirects , renders success/failure html.

i using django messaging framework display success/failure messages on form submission status.

all works except when user reloads status page, message popped , blank screen.

i wondering correct treatment scenario is. should redirect homepage if there no messages, or maybe have generic two-liner fail-safe?

ps: if not appropriate question on so, kindly recommend alternate site me ask question, couldn't find any.

the messages displayed using django messages framework displayed once in subsequent request. if refresh page or go page, message disappear. intended behaviour of using messages.

as per django messaging framework docs:

quite commonly in web applications, need display one-time notification message (also known “flash message”) user after processing form or other types of user input.

the messages framework allows temporarily store messages in 1 request , retrieve them display in subsequent request (usually next one).

to solve issue, can send success or failure parameter in url parameters , display message in template according value. then, when user refreshes page, message text still displayed in template.


Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

python - RuntimeWarning: PyOS_InputHook is not available for interactive use of PyGTK -