Hi Shawn-

There is a consensus in the web development community at large -- the HTTP Spec 
itself touches on it, and the W3C has released a few supporting statements as 
well.

http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html
This is the HTTP 1.1 spec, section 9, which defines the difference between the 
various verbs, including GET and POST, in terms of idempotence.

And this helps clarify:
http://www.w3.org/2001/tag/doc/whenToUseGet-20040321

For your use case, I would definitely use GET. The user may wish to bookmark 
the report, for example, or send it to a colleague. Searches and such should 
always use GET, unless there's a truly compelling reason not to.

POST should only be used for things that change stuff on the server... a 
contact form, a form that creates something in a database, etc...


Cheers!
-Steve

====================================
Steven L Smith, Web Developer
Department of Information Technology Services
Nazareth College of Rochester
585-389-2085 | ssmit...@naz.edu | KC2YTC
http://www.naz.edu/pub/~ssmith46
====================================

----- Original Message -----
From: "Shawn Milochik" <sh...@milochik.com>
To: django-users@googlegroups.com
Sent: Monday, June 13, 2011 12:45:39 PM GMT -05:00 US/Canada Eastern
Subject: GET vs POST for read-only views

Is there a consensus in the community that GET should be used for
requests that don't write to the database? As a specific example, let's
say there's a report form that allows a user to select a start and end
date, and maybe some other search fields. What would you use for this,
and why?

I use POST for almost everything, but I admit it's mainly to avoid
super-ugly URLs full of querystring content.

Thanks,
Shawn

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to