Re: request.method GET or POST
On Jul 12, 7:04 am, Venkatraman S <venka...@gmail.com> wrote:
> We have to check for request.method to suitably route the request to the
> logic.
>
> Would it be nice if we have something like doGet or doPost(similar to java
> servlets) that we have in our views,
> so that the request gets automatically routed , and the code is structured
> nicely?
Most often than not, there's common code before and after the
request.method specific branches, so handling both in a same
function / method makes sense. But if you want automatic
request.method-based dispatch, that quite easy to implement, using
either a class-based view and/or a custom decorator working the same
way as the Python builtin property type works for getter and setter.
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home