-
Notifications
You must be signed in to change notification settings - Fork 40
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
Only integer PK fields currently supported; str or uuid pk throws NoReverseMatch exception #11
Comments
Hey @phoikoi 👋 Yes... it is a TODO. I've been pondering various options. In the name of simplicity, I'm leaning towards a straight attribute here, maybe neapolitan/src/neapolitan/views.py Lines 77 to 78 in 16c1259
Note, My suspicion is that the kind of mapping logic you've sketched would forever ramify, for not much gain. (Beyond the different types in play, I frequently use custom converters, and there's no way for Neapolitan to know about those.) A simple attribute, which could be injected via the
What do you think? |
Yes, I definitely see how it could get very branchy. I did briefly look at the converters code in Django, and it appears you can get a list of all default and registered converters via But if the attribute route seems more orthogonal to your intended design or has other salient features that turn up, I won't complain about it being the Chosen Path. :) |
😜
If you wanted to make a PR adding the attribute, and making use of |
Fixed in 24.4 |
From reading the source at the end of
views.py
, it seems this is a known problem. But I thought I'd surface it in an issue as I am working on a possible solution for it, which can be seen here: phoikoi@3efbded . I have not made a pull request yet as I don't have tests written for it. But just as an idea jumping off point, perhaps it might be useful even now. (Note: I would recommend leaving FloatField pk support for a later version.) ;)The text was updated successfully, but these errors were encountered: