Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7k
Add SimplePathRouter#6789
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Add SimplePathRouter#6789
Conversation
lovelydinosaur commentedJul 8, 2019
Milestoning for review. Thanks! |
sevdog commentedJul 8, 2019
It may be improved a bit if support for Django 1.x gets dropped (ie: some bad |
rpkilby commentedJul 8, 2019
I'm thinking this should be pushed to the 3.11 release, as that is when we'll likely drop Django 1.11 |
lovelydinosaur commentedJul 9, 2019
@rpkilby Good call |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
sevdog commentedJul 13, 2019
@rpkilby I have updated with CRUD tests and removed Django 1.11 compact. Tell me if everything is fine for you. |
7a17941 toc4c09efCompare
auvipy left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
can you skip tests for Django 1.11 for this PR? dj1.11 seems to be supported for some more time.
sevdog commentedNov 21, 2019 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I have also added an assertion in |
sevdog commentedNov 22, 2019
Ok... seems that |
auvipy left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
can you rebase plz?
17af0e1 toc1348cfComparesevdog commentedDec 5, 2019
Rebased. |
lovelydinosaur commentedDec 12, 2019
We've not dropped 1.11 on this pass, since its LTS. Wondering if we might just outright switch the behavior on the next release - I'd rather wedidn't have two different have two different class implementations here. |
sevdog commentedDec 12, 2019
@tomchristie you are right that a single-class implementation would be better. I think that it can be done since the difference between those two are just two methods ( I will try to refactor the code to have a single class. |
lovelydinosaur commentedDec 12, 2019
When we drop 1.11 I'd actually probably be okay with us justcompletely switching to There's not really any great options for us here. |
b1d231f to4696b19Comparesevdog commentedOct 18, 2022
@auvipy I have rebased the branch with current master. Let me know if any other change is needed. |
auvipy commentedOct 18, 2022
the workflow need to be triggered |
camuthig commentedOct 27, 2022
I am playing around with this PR a bit, and in my case the major reason I am trying to move to I am able to make this work with the code in this PR by setting This isn't a blocker, since it seems to be working just fine, but figured it was worth bringing up while it is still in PR. If there is an alternative way to approach these custom converters, let me know, and I will give that a try too. |
sevdog commentedOct 28, 2022
@camuthig you pointed out an interesting use case. I could change the code to use an "alternative" attribute with a more readable name to solve it, but this feels quite a mock-fix IMO. Preserve backwards compatibility and handle this use case in an elegant way is a bit hard. I would like to go back to my first implementation where there were 2 base router classes: one for regex and one for path, so there is no chance of mixing code and name would be quite expressive (but the project ownerclearly expressed he prefers to have a single class). The other way I see is to rework the current implementation in order to handle the choice between regex or path on aper view basis and not globally on the router, the problem here is to handle @tomchristie what do you think would fit better? |
auvipy commentedNov 21, 2022
Let us focus on the actual issue first. we are going to make the SimplRouter allowing new path based routing. should we also do the same for the DefaultRouter? |
sevdog commentedNov 21, 2022
@auvipy, do you mean this line?
Apart from that |
auvipy commentedNov 21, 2022
yeah, OK. I got commit access recently. so want to prioritize this one and draw a conclusion very soon to get this merged. of course considering all the natural edge cases are ironed out |
Uh oh!
There was an error while loading.Please reload this page.
| notes_router=SimpleRouter() | ||
| notes_router.register(r'notes',NoteViewSet) | ||
| notes_path_router=SimpleRouter(use_regex_path=False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
can we add another test case which use DeafultRouter please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
It should not be a problem to replicate that test also with the other router.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Co-authored-by: Éric <merwok@netwok.org>
Co-authored-by: Éric <merwok@netwok.org>
sevdog commentedNov 23, 2022
I have added a small change to address the semantic issue pointed by@camuthig. |
auvipy commentedNov 23, 2022
that's great. do you see any other documentation changes needed for this? |
| class MyPathModelViewSet(mixins.RetrieveModelMixin, viewsets.GenericViewSet): | ||
| lookup_field = 'my_model_uuid' | ||
| lookup_value_converter = 'uuid' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
can we use better name for lookup_value_converter?any better suited name instead of converter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I used "converter" since django calls these elementspath converters, maybe we can use the full expanded name to havelookup_value_pathconverter (orlookup_value_path_converter).
Any suggestion is welcome.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I would inclined to@tomchristie for a better insight here as I'm bit confused about naming
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
what about just lookup_value_path? this alighned with the name lookup_value_regex
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I think that it would be better to use the same naming of django.
In this case it was named "converter" thus an attribute which should define one should be named after that. In this way it is easier to find references to what this element does.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
OK I am going to merge this, we can improve it if needed
Uh oh!
There was an error while loading.Please reload this page.
Description
Add
SimplePathRouterto handle Django 2.xpath converters (refs#6148).