Replies: 12 comments
-
I like the idea 👍 I think to register related urls as implemented in #451 will be fairly straight forward. With RelationshipView is going to be a bit harder but playing around with implementation might lead to a good solution. Only thing which also need to be considered is to implement a json api specific |
Beta Was this translation helpful? Give feedback.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
-
I've "moved" this comment thread about naming to it's own issue: #471 |
Beta Was this translation helpful? Give feedback.
-
might be related encode/django-rest-framework#6789 |
Beta Was this translation helpful? Give feedback.
-
Is this something the project is still interested in? When I started using DJA, I found it a little frustrating and unintuitive that we couldn't just "automatically" include the relationship and related resource routes. If a PR is likely to be accepted, I could look into this within the next 1-2 weeks. |
Beta Was this translation helpful? Give feedback.
-
A PR is certainly welcome in this regard |
Beta Was this translation helpful? Give feedback.
-
@platinumazure I don't think this will be straight forward but I would love to see this implemented as well. |
Beta Was this translation helpful? Give feedback.
-
This is a great idea which we should investigate further. Especially thinking about how the I do think though we should talk this through more about what a proper design of a DJA router would be and of such a discussion or proof of concept in that regard extract specific issues. Therefore converting this issue to a discussion. |
Beta Was this translation helpful? Give feedback.
-
Adding support for the built-in DRF routers would 100% clean up all the URL definition files and make DJA consistent with DRF. 👍 |
Beta Was this translation helpful? Give feedback.
-
Proposal:
rest_framework_json_api.routers.DefaultRouter
Current method of declaring
URLPatterns
The current typical usage example is like this:
URLPatterns created by the Default Router
The above creates the following URLPatterns for
router.register(r'blogs', BlogViewSet)
:along with an
api-root
view that lists the available registry entries. This is a nice feature.Drawbacks of the current method
.<format>
flavor of each ViewSet. (Not a huge concern.)Proposed:
rest_framework_json_api.DefaultRouter
Create a DJA DefaultRouter that extends DRF's DefaultRouter:
RelationshipView
. This seems pretty straightforward. Just add another argument toDefaultRouter.register()
(or apply a default naming pattern) to add the RelationshipView.The goal would be to have a URLPatterns that looks like this:
For how to do the "related stuff here" take a look at @Anton-Shutik's approach in #451
Beta Was this translation helpful? Give feedback.
All reactions