Correct me if I'm wrong but it seems your "method" function is
supposed to return the request method type(POST or GET) sent to the
view. If I'm correct then your syntax will always return GET. That's
because I think all the django middleware workings adjust the initial
arguments and the response such that it always ends up as a GET.
Try storing request.method in a variable first and then return that
variable with your HttpResponse like

def method(request):
    method_type = request.method
    Return HttpResponse(method_type)

Haven't tried it but I'm sure this will give the desired result

On 9/20/11, Fabio Natali <fa...@fnstudio.it> wrote:
> Hi everybody!
>
> I have a very simple view which is supposed to print out GET or POST,
> depending which has been used to send data. The problem is I always get
> "GET" even when sending data via POST.
>
> ### views.py:
> def method(request):
>      return HttpResponse(request.method)
>
> ### urls.py:
> (r'^method/$', method)
>
> ### php script to send data to the Django page:
> <form method="post" action="http://192.168.0.2:8000/method/";>
>    <input type="text" id="firstname">
>    <input type="submit" value="Send">
> </form>
>
> I am running Django version 1.2.5, development server.
>
> Am I missing something? Any hint?
>
> Thanks, Fabio.
>
> --
> Fabio Natali FNstudio
>
> --
> 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.
>
>

-- 
Sent from my mobile device

-- 
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