Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.

#1 June 14, 2010 10:48:13

k.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

HttpRequest.DELETE implemented?


Hi Djangos,

is this working like expected with recent django version:?

def myview(request):
if request.is_ajax:
if request.DELETE #or alternatively if request.method=='DELETE':
MyModel.objects.get(id=request.DELETE).delete()

or do i have to go through POST and for example hidden form fields?

thanks
kalinski

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#2 June 14, 2010 10:50:43

k.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

HttpRequest.DELETE implemented?


well the answer is "no" yes?:

<HttpRequest
GET:{},
POST:{},
COOKIES:{},
META:{}>



On Jun 14, 11:48 am, kalinski <kalin...@amei.se> wrote:
> Hi Djangos,
>
> is this working like expected with recent django version:?
>
> def myview(request):
>    if request.is_ajax:
>       if request.DELETE #or alternatively if request.method=='DELETE':
>          MyModel.objects.get(id=request.DELETE).delete()
>
> or do i have to go through POST and for example hidden form fields?
>
> thanks
> kalinski

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#3 June 14, 2010 13:08:22

Javier G.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

HttpRequest.DELETE implemented?


On Mon, Jun 14, 2010 at 4:48 AM, kalinski <kalin...@amei.se> wrote:
> MyModel.objects.get(id=request.DELETE).delete()


request.GET is a parsing of the 'query' part of the URL.
request.GET is a parsing of the content of the request.
request.COOKIES is a parsing of some headers of the request.

what are you expecting to show up as request.DELETE ?

--
Javier

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#4 June 14, 2010 16:01:30

Matt H.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

HttpRequest.DELETE implemented?


>From glancing at the code for the modpython and wsgi core handlers I
think django always puts the URL arguments into "request.GET"
regardless of method (i.e. it's not restricted to just GET and POST
requests, since query strings on URLs can exist for any method) where
as "request.POST" will only be populated from a POST.

So you would do:
if request.method=='DELETE':
MyModel.objects.get(id=request.GET).delete()

(assuming, based on your code, that your client software is genuinely
doing an HTTP DELETE request and that you have an id in the query
string part of the URL)

On Jun 14, 10:48 am, kalinski <kalin...@amei.se> wrote:
> Hi Djangos,
>
> is this working like expected with recent django version:?
>
> def myview(request):
>    if request.is_ajax:
>       if request.DELETE #or alternatively if request.method=='DELETE':
>          MyModel.objects.get(id=request.DELETE).delete()
>
> or do i have to go through POST and for example hidden form fields?
>
> thanks
> kalinski

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#5 June 14, 2010 18:29:30

k.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

HttpRequest.DELETE implemented?


thanks a lot!

i'll try Matts solution, it's exactly what i wanted to do,
using jquery to send an $.ajax request with method DELETE and id of
the object to delete
in the url params...



On Jun 14, 5:01 pm, Matt Hoskins <skaffe...@googlemail.com> wrote:
> From glancing at the code for the modpython and wsgi core handlers I
> think django always puts the URL arguments into "request.GET"
> regardless of method (i.e. it's not restricted to just GET and POST
> requests, since query strings on URLs can exist for any method) where
> as "request.POST" will only be populated from a POST.
>
> So you would do:
> if request.method=='DELETE':
>   MyModel.objects.get(id=request.GET).delete()
>
> (assuming, based on your code, that your client software is genuinely
> doing an HTTP DELETE request and that you have an id in the query
> string part of the URL)
>
> On Jun 14, 10:48 am, kalinski <kalin...@amei.se> wrote:
>
>
>
> > Hi Djangos,
>
> > is this working like expected with recent django version:?
>
> > def myview(request):
> >    if request.is_ajax:
> >       if request.DELETE #or alternatively if request.method=='DELETE':
> >          MyModel.objects.get(id=request.DELETE).delete()
>
> > or do i have to go through POST and for example hidden form fields?
>
> > thanks
> > kalinski

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

Board footer

Moderator control

Enjoy the 18th of October
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support