Skip to content
Discussion options

You must be logged in to vote

The issue is caused by using <path:object_id>, which is greedy and captures 1/password as the object ID, so Django routes it to the change view.

Fix: don’t use <path:object_id> in admin URLs. Use a non-greedy converter instead.

def get_urls(self):
    return [
        path(
            '<int:object_id>/password/',
            self.admin_site.admin_view(self.mymodel_change_password),
            name='mymodel_password_change',
        ),
    ] + super().get_urls()

This prevents password from being swallowed by the change view and resolves the URL correctly.

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by bckohan
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #381 on January 07, 2026 18:06.