1

I am newer to Django and wanted clarification on an issue I noticed with HttpRequest. It appears that when you request a page the default request.method is GET. My question is, are all page request GETs be default, unless you specify POST or otherwise?

I had thought that GET was related to submission forms and had to be defined in HTML, but Django views in my project that have no forms or anything show request.method == GET.

I searched google and Django but that did not clarify things for me, if you understand this better please share.

Thanks.

esse
  • 5,429
  • 3
  • 19
  • 20
  • You actually have them backwards. See http://stackoverflow.com/questions/46585/when-do-you-use-post-and-when-do-you-use-get – Zee Jan 16 '12 at 01:14

1 Answers1

4

This isn't a Django-specific question, it's much more general.

  • GET is the default request method for browser-based HTTP requests, intended for reading resources from the server.

  • Other methods, such as POST, PUT, and DELETE, generally require a form submission (for user-initiated requests in a browser) or explicit headers (for script-initiated requests). These methods are intended for user actions that create, update, or delete data on the server.

See the W3 HTTP 1.1 specification for more information on the different types of request methods.

nrabinowitz
  • 55,314
  • 10
  • 149
  • 165