django: search forms and redirect

After processing form from POST I should redirect, to prevent user from hitting back. However, I am using form to determine search query on a database, so I need to either pass params to the redirected site or the result of a search. Or maybe there is some other good practice, how to solve this problem? Maybe in this situation I am allowed not to redirect (nothing happens, if user performs search again).

Answers


Search queries should probably be GETs, rather than POSTs, because they are not changing anything - they are simply passing parameters to get certain information. POST should be reserved for forms that actually change things in the database, or result in a specific action (eg submitting an email).

To reply to your comment, hiding parameters from URLs is not particularly good practice, but if you really think you need to, this is an instance where it's OK not to redirect after the form submission - again, because you're not affecting anything with the POST.


Need Your Help

Python: write to file multiple times without open/close for each write

python file

How can i open file in python and write to it multiple times?

How to use internal namespace in javascript moduler pattern

javascript jquery design-patterns

i have 2 .js utility files. and im using module pattern like below. MODULE1 & MODULE2 are global namespaces. In addition internally both the .js files are using same variable name for namespace...