jrief / django-angular

Let AngularJS play well with Django
http://django-angular.awesto.com/
MIT License
1.23k stars 293 forks source link

Add tests/docs and code for featue allowed_methods for NgCRUDView #176

Closed adrienbrunet closed 9 years ago

adrienbrunet commented 9 years ago

I don't know if you use DRF with django-angular or something similar but maybe we should documented how to interconnect DRF and django-angular more precisely.

For really simple project, I often use directly the NgCRUDView. I regularly need to override the dispatch method to block one or more method. Maybe I'm not the only one. Here is a pull request to handle that problem. Tell me if anything is wrong with it! Feel free to correct my english as well in the docs!

Cheers

jrief commented 9 years ago

I extensively combine DRF with django-angular. For form rendering and djangoURL I use django-angular, with DRF. IMHO, DRF is an excellent framework, but does not make a good job with forms rendered in HTML. Maybe I missed something.

adrienbrunet commented 9 years ago

No, I think you're right. But the threshold between using DRF and just a bunch of CRUD views generated with NgCRUDView is not really clear. If you're not dealing with a lot of serialization and permission problem, NgCRUDView does a pretty good job. I'm now lacking some features with it. (That's why I did this PR). Should I just use DRF instead?

jrief commented 9 years ago

Well, DRF pulls in a big framework. I can't give any recommendation here. It all depends on the projects needs. It probably is not a good idea trying to reinvent DRF features inside django-angular.

adrienbrunet commented 9 years ago

No problem. I close the PR then =)

jkosir commented 9 years ago

Yep, I originally intended crud view to be used only when standard angular's $resource functionality is required i.e. simple CRUD operations. While adding features makes it better there's no point in reinventing rest-framework.

This update seems good though, I think we could merge it anyway?

adrienbrunet commented 9 years ago

Well, it's not a big PR but I don't want for sure to reinvent rest-framework!

jkosir commented 9 years ago

I'd still merge this. @jrief what do you think?

jrief commented 9 years ago

A similar functionality is available for DRF's ViewSet's so from my point of view, this should be OK.