I'm trying to use Django-Angular to make a AJAX call to a view in Django. I'm following this guide here.
However, when I make a POST I'm getting the message: CSRF verification failed. Request aborted. It seems like the action
as described in the docs process_something
isn't being called as I shouldn't need the token.
Can anyone spot the issue, below is what I have tried so far...
Here is the relevant js controller script:
var in_data = {action: 'process_something', somevar: $scope.somevar};
var post_call = CbgenRestangularDjango.all('pin-verification/').post(in_data)
and the form:
<form ng-controller="PinValidationFormCtrl" name="CompanyValidPinForm" class="bs-callout">
<div class="col-xs-2">
<input class="form-control" name="somevar" ng-model="somevar" type="text">
</div>
<div class="col-xs-2">
<button type="button" class="btn btn-default" ng-click="submitPin()">Verify Pin</button>
</div>
</form>
and the view:
class VerificationView(JSONResponseMixin, View):
# other view methods
@allowed_action
def process_something(self, in_data):
# process input data
out_data = {
'foo': 'bar',
'success': True,
}
return out_data