I’ve been around the Django Discord for a while and I was looking around for a ticket to pick up as an entrypoint into contributing to Django in other ways. I found this one from quite a few years ago, with little movement, and thought it might be a good place to start:
As I see it, there’s three places this could be supported:
django.urls.reverse
django.shortcuts.redirect
the url template tag
As a starting point, I wrote a basic implementation of the feature for django.urls.reverse and started a draft pull request with it, along with three very simple tests.
The other two places are more challenging from a design perspective, because they both assume any kwargs passed to them are URL kwargs, and therefore “stealing” two kwargs for another purpose could break some existing codebases.
As this is my first go at working on the Django codebase, I’d appreciate the following:
any guidance or suggestions for improving the existing PR, including the tests
any design suggestions on how to implement the feature for the remaining to places it could be of use, if indeed it’s wanted
Hey Ben, thanks for picking up a 9 year old ticket
Just took at look at what $job did… I can’t share the snippet but the person who wrote it for some reason felt the need to filter out None values from the supplied params
Also worth considering whether urlunparse() is an option to construct the result, though not sure what else it would bring other than a slight readability (debatable) gain?
Looks very straight forward and reasonable to me. I had a minor thing about it seeming reasonable to support a plain dict, but that’s like two lines of code.