Re: How to check if a request was a POST or GET

2006-08-24 Thread fdb

Thanks! That's what I needed!

Kind regards,

Frederik


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Re: How to check if a request was a POST or GET

2006-08-24 Thread Chris Long

Might be of help:

http://www.djangoproject.com/documentation/request_response/#httprequest-objects

if request.method == 'GET':
do_something()
elif request.method == 'POST':
do_something_else()

Chris


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



How to check if a request was a POST or GET

2006-08-24 Thread fdb

Hi,

I'm trying to detect if a request is a POST or a GET. This is what I'm
doing:

if request.POST:
# do stuff

However, this only works if there are some variables in the POST. The
request I'm doing is empty (it's an ajax "delete" request). Is there a
way to check if the request was a POST, even if no actual parameters
are posted with it? Is this a Django bug?

Kind regards,

Frederik


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---