hi Miranda,

Try this:

scope.deleteeeMovie $ = function (id) {
* $scope.deleteeeMovie = function(ID){*
* $http({*
* method: 'POST',*
* url: "http://localhost:8080/test/delete/51c82ba48774a7118875b145",*
* //data: {'id': ID}
                data: {**'id': ID: id_checked, 'csrfmiddlewaretoken':
'{{csrf_token}}'},
*
* headers: {*
* "Content-Type": "application/json; charset=utf-8"*
* }*
* }).success(function(data){*
* console.log(data);*
* }); *
* };*





2013/6/24 Hélio Miranda <helio...@gmail.com>

> Hi!
> My problem is this, I have the following function:
> *def delete (request, id):*
> *     if request.method == 'POST':*
> *         my_painting Movie.objects.get = (id = id)*
> *         for img in my_painting.MovieCover:*
> *             img.delete ()*
> *         my_painting.delete ()*
> *
> *
> *     return render_to_response ('delete.html', {},*
> *                               context_instance = RequestContext
> (request))*
>
> In that when I go to the template, this url (
> http://localhost:8080/test/delete/51c82ba48774a7118875b145), and carry on
> a button that set, it performs the function, everything ok.
>
> The issue is that I wanted on the client side send this request without
> having to go through the template and press the button.
> I was trying to do something like this, client-side
>
> scope.deleteeeMovie $ = function (id) {
> * $scope.deleteeeMovie = function(ID){*
> * $http({*
> * method: 'POST',*
> * url: "http://localhost:8080/test/delete/51c82ba48774a7118875b145",*
> * //data: {'id': ID}*
> * headers: {*
> * "Content-Type": "application/json; charset=utf-8"*
> * }*
> * }).success(function(data){*
> * console.log(data);*
> * }); *
> * };*
>
> But I get the following error:
> *Forbidden (403)*
> *CSRF verification failed. Request aborted.*
>
> I do not know if I'm doing something wrong-side or client Django ...
> someone help me?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
Nadae Ivar BADIO

+221 70 644 38 44

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to