blacklocus / angular-django-rest-resource

An AngularJS module that provides a resource-generation service similar to ngResource, but optimized for the Django REST Framework.
Other
251 stars 29 forks source link

Trailing / now in AngularJS #13

Open cancan101 opened 10 years ago

cancan101 commented 10 years ago

Was the "Trailing slashes allowed in the resource URLs per the Django community norm." feature added in the 1.3.x release of Django (see: https://docs.angularjs.org/api/ngResource/service/$resource and https://github.com/angular/angular.js/blob/master/CHANGELOG.md)

JustinTArthur commented 10 years ago

Yep, assuming you mean 1.3.x of AngularJS. If its in stable, I'll incorporate their version in the next release. Thanks!

paramburu commented 9 years ago

@JustinTArthur I'm using django-angular to populate the apis urls in the template and django-rest-framework as an api "backend". The problem is when I'm trying to do a query or a get without the id, it leaves two trailing slashes resulting in a 404 Not Found.

In this case, django-angular creates the following model-list and model-detail urls:

I thought I should be able to use model-detail as the main url because it should simply ignore empty parameters but instead is making a GET request to "/api/app/model//" (two slashes) resulting in 404. I think the :format parameter might be the problem here.

For now I can hardcode the url "/api/app/model/:pk" or "/api/app/model/:pk/" and it works but for simplicity I would prefer using django-angular.