-
Notifications
You must be signed in to change notification settings - Fork 300
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
proposal: DJA DefaultRouter #467
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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 |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Per discussion about naming, the idea is that it should be easy to updgrade from DRF to DJA by simply changing some imports, retaining the same DRF (or in this case, django-filter) class names that are extended by DJA. see django-json-api#467 (comment)
- see django-json-api#467 (comment) - JSONAPIPageNumberPagination goes back to PageNumberPagination - JSONAPILimitOffsetPagination goas back to LimitOffsetPagination - requires new setting: `JSON_API_STANDARD_PAGINATION=True` to get `page[number]` and `page[size]` instead of `page` and `page_size`. This is a breaking change no matter which is the default value.
- see django-json-api#467 (comment) - JSONAPIPageNumberPagination goes back to PageNumberPagination - JSONAPILimitOffsetPagination goas back to LimitOffsetPagination - requires new setting: `JSON_API_STANDARD_PAGINATION=True` to get `page[number]` and `page[size]` instead of `page` and `page_size`. This is a breaking change no matter which is the default value.
This comment has been minimized.
This comment has been minimized.
I've "moved" this comment thread about naming to it's own issue: #471 |
might be related encode/django-rest-framework#6789 |
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. |
A PR is certainly welcome in this regard |
@platinumazure I don't think this will be straight forward but I would love to see this implemented as well. |
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. |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
The text was updated successfully, but these errors were encountered: