-
-
Notifications
You must be signed in to change notification settings - Fork 31.4k
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
Add a listurls management command #18347
base: main
Are you sure you want to change the base?
Conversation
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.
Hello! Thank you for your contribution 💪
As it's your first contribution be sure to check out the patch review checklist.
If you're fixing a ticket from Trac make sure to set the "Has patch" flag and include a link to this PR in the ticket!
If you have any design or process questions then you can ask in the Django forum.
Welcome aboard ⛵️!
I will try to do a full review during the week. But for now, I would note that you need to squash your commits into one and follow the commit style guide, and update the PR title to match. |
a3a6ab6
to
845340d
Compare
Introduce a new admin command that lists URLs in the application, either in a long form or in a compact tabular form. It includes an option to limit the listing to URL prefixes.
Hopefully this meets approval. I went back and forth on the commit message a few times, apologies for the chaos. |
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.
Thanks for pushing this forward! 🥇
I've left a few small comments inline. One thing I noticed when testing is that the output with the --table
option seems a bit surprising.
In my test project with django-extensions I see.
/ bootstrap4.views.index
/bootstrap3 bootstrap3.views.index bootstrap3.views.index
With the new listurls
command:
<function index at 0x000002216F5DF600>.index
django <function index at 0x000002216F634E00>.index django_rendering.views.index
I can see two differences. The urls do not have a leading /
which I'm not sure is an issue but means that nothing is shown for the /
case. Also the view_methods
are incorrectly formatted.
The leading /
is also an issue for the longer output format where the URL
field is blank.
URL:
View: bootstrap4.views.index
Arguments:
help="Only list URLs with these URL prefixes.", | ||
) | ||
|
||
parser.add_argument( |
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.
Do we need to have multiple output formats? I couldn't see any discussion on this, so apologies if I've missed something here.
The table option seems closer to what django-extensions show_urls
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.
The table option is what show_urls
did, but the long form is what @hippietilley put in their original patch; given I was carrying on their work, it seemed polite to include their format. I'm happy to reverse the defaults, or elide it, but I didn't want to be rude about the work they already did.
I'll look at the output again; I suspect I missed something in the view lookup code and URL formatting. Updates to come. |
Trac ticket number
ticket-28800
Branch description
This picks up work started by @hippietilley on their hippietilley/django#ticket_28800 branch.
I have made a couple of changes:
Checklist
main
branch.Notes
I was unable to find where tests for management commands belong; happy to add them, but wasn't aware of how.
I'm not sure what documentation other than the manual should be updated; I'd love it if someone pointed me at that.