Comments (11)
I initially used the dasherized version but @g-cassie pointed out that DRF defaults to the lower-cased pluralized model name without dashes. There's even a note about this in the README:
https://github.com/dustinfarris/ember-django-adapter/blob/version-1.0/README.md#path-customization
Personally I'll always use the dasherized version because I think it's easier to read and it's more like django slugs but I'm also ok with overriding this to my preference. We should just pick one version and document it. I'm ok if it goes back to the dasherized version.
from ember-django-adapter.
I must have missed the discussion. I didn't realize DRF made a decision in that regard.
My understanding is that the user makes this distinction when creating a router, e.g.:
router = DefaultRouter()
router.register(r'furry-animals', viewsets.FurryAnimalViewSet)
I realize that DRF does a lowercase dash-less version of the model name when creating internal references, e.g.:
reverse('furryanimal-list')
which is more or less in line with how Django handles ContentTypes; but this has nothing to do with the URL. Or am I missing something?
from ember-django-adapter.
Yeah, you're correct. I thought that the URL would be generated if you didn't provide it. I just read the DRF code and that's not correct. @g-cassie even figured out the initial mistake about confusing the URL and the internal reference in #11 but I still thought keeping the change in - I don't remember why, sorry. I agree with changing to the dasherized version.
from ember-django-adapter.
My other point was that @detail_view and @list_view default to underscorized urls which is why I thought it made sense to default to underscore on the adapter side. I think either way works but you should add docs for setting up @detail_view and @list_view to have dasherized urls.
from ember-django-adapter.
related conversation regarding detail_view/list_view URLs:
encode/django-rest-framework#2010
it looks like @tomchristie is on board with at least making dashes an option for these endpoints, although it may not happen for a while.
regardless, to my knowledge there is no native Ember functionality that makes use of custom endpoints like these (correct me if I'm wrong) so our dasherizing policy should stem from best/common practices seen in basic CRUD URLs
from ember-django-adapter.
Resolved in #28
from ember-django-adapter.
I haven't looked at the code for your rewrite in detail but I remember Toran's adapter required urls for nested objects like /dealerships/1/cars/
and I was using @detail_view to implement these. I can't remember how multi-word models were treated. In any event if you want to support this kind of route structure than you should consider the following viewset.
class ZooViewSet(viewsets.ModelViewset):
@detail_view(methods=['get'])
def fuzzy_animals(self, request):
queryset = self.get_object().fuzzy_animals.all()
serializer = FuzzyAnimalSerializer(queryset, many=True)
return serializer.data
from ember-django-adapter.
Good point. We will need to investigate this further. I vaguely recall thinking that endpoints for nested relationships like this were no longer necessary, but I can't remember what the reasoning was, or if I was even correct.
Anyway, we should probably open a new issue for this specific requirement.
from ember-django-adapter.
You may be thinking of the coalesceFindRequests
option that was introduced in beta.9. However DRF does not natively support the requests ED generates with this option enabled so I think there is still work to be done on the adapter side.
from ember-django-adapter.
Gotcha. Would you mind opening an issue for it?
from ember-django-adapter.
Done: #32
from ember-django-adapter.
Related Issues (20)
- What are the advantages/disadvantages of using this package vs django-rest-framework-json-api? HOT 2
- Fastboot - Error: The adapter operation was aborted HOT 3
- upload file
- Why embedded record is not populated with Ember.Model? HOT 2
- An in-range update of loader.js is breaking the build 🚨 HOT 9
- An in-range update of ember-data is breaking the build 🚨 HOT 11
- An in-range update of ember-cli-htmlbars is breaking the build 🚨 HOT 1
- Correctly serialize lists of URLs for nested relationships HOT 3
- An in-range update of ember-disable-prototype-extensions is breaking the build 🚨 HOT 1
- An in-range update of ember-cli-inject-live-reload is breaking the build 🚨 HOT 1
- Upgrade ember-cli
- Dependecy problem with ember-inflector HOT 1
- Update to Ember-Data v3.0 HOT 21
- Acceptance test fails because CRUD operation didn't finish up before app shutdown HOT 4
- Generate adapter and serializer in pods
- CircleCI fails with pip install mkdocs HOT 11
- Easy to get multiple versions of ember-data HOT 1
- Website/Documentation 404 HOT 8
- Import AdapterError and InvalidError from "DS" object HOT 1
- No release with latest commits HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ember-django-adapter.