Re: request.method not working as expected

2011-09-21 Thread Fabio Natali
On 09/21/2011 03:32 PM, Fabio Natali wrote: [...] Yes, I'll follow Andres Reyes advice and use {% url %} tag. I'm still having a few problems with it, but it sounds like the way to go. Ok, it works now. I just had to use the proper syntax! :-) ### urls.py ... url(r'^add_to_cart/$',

Re: request.method not working as expected

2011-09-21 Thread Fabio Natali
On 09/21/2011 09:37 AM, Babatunde Akinyanmi wrote: Your post showed the trailing url... Yes! You are perfectly right, it was my fault! (But you have to admit it was hard to find, that little trailing slash! :-)) anyway I agree with your diagnosis. [...] Yes, I'll follow Andres Reyes

Re: request.method not working as expected

2011-09-21 Thread Fabio Natali
On 09/21/2011 09:39 AM, Babatunde Akinyanmi wrote: What's in your add_to_cart view function? Hi Babatunde, at the moment, the add_to_cart view is just printing the POST data on the screen. Cheers, Fabio. -- Fabio Natali FNstudio http://fnstudio.it fabio_natali@skype -- You received this

Re: request.method not working as expected

2011-09-21 Thread Babatunde Akinyanmi
What's in your add_to_cart view function? On 9/21/11, Fabio Natali wrote: > On 09/21/2011 07:57 AM, Andres Reyes wrote: >> I believe that the best practice is to always use the {% url %} template >> tag and not hardcoding your URL's > > That makes perfect sense. Thanks for

Re: request.method not working as expected

2011-09-21 Thread Babatunde Akinyanmi
Your post showed the trailing url...anyway I agree with your diagnosis. With my noob knowledge of django, django tries to add a trailing slash to your url when you don't. I believe she does that by adding the trailing slash to the url and then asking the server to redirect to the url which is the

Re: request.method not working as expected

2011-09-21 Thread Fabio Natali
On 09/21/2011 07:57 AM, Andres Reyes wrote: I believe that the best practice is to always use the {% url %} template tag and not hardcoding your URL's That makes perfect sense. Thanks for your precious tip! So I added {% url add_to_cart %} to my template. However, it silenty fails and I am

Re: request.method not working as expected

2011-09-20 Thread Andres Reyes
I believe that the best practice is to always use the {% url %} template tag and not hardcoding your URL's 2011/9/20 Fabio Natali > On 09/20/2011 07:15 PM, dm03514 wrote: > >> Fabio in your dev server output is it saying the type of request is >> get? >> ARe you accessing

Re: request.method not working as expected

2011-09-20 Thread Fabio Natali
On 09/20/2011 07:15 PM, dm03514 wrote: Fabio in your dev server output is it saying the type of request is get? ARe you accessing "/method/" through your form or are you just directing your webserver to http://192.168.0.2:8000/method/??? Hi dm03514 and thanks for your help! Thanks to your

Re: request.method not working as expected

2011-09-20 Thread Fabio Natali
On 09/20/2011 07:12 PM, Babatunde Akinyanmi wrote: 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

Re: request.method not working as expected

2011-09-20 Thread dm03514
Fabio in your dev server output is it saying the type of request is get? ARe you accessing "/method/" through your form or are you just directing your webserver to http://192.168.0.2:8000/method/??? On Sep 20, 11:46 am, Fabio Natali wrote: > Hi everybody! > > I have a very

Re: request.method not working as expected

2011-09-20 Thread Babatunde Akinyanmi
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

Re: request.method not working as expected

2011-09-20 Thread Fabio Natali
On 09/20/2011 05:53 PM, DrBloodmoney wrote: On Tue, Sep 20, 2011 at 11:46 AM, Fabio Natali 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

Re: request.method not working as expected

2011-09-20 Thread DrBloodmoney
On Tue, Sep 20, 2011 at 11:46 AM, Fabio Natali 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: >

request.method not working as expected

2011-09-20 Thread Fabio Natali
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: