reversing admin "change" url

186 Views Asked by At

I´m trying to find some example of how to use change url of modelAdmin and what exactly result it gives. Sincerly I do not understand the part from docs:

"This will find the first registered instance of the admin application (whatever the instance name), and resolve to the view for changing poll.Choice instances in that instance."

1

There are 1 best solutions below

0
willeM_ Van Onsem On BEST ANSWER

You can reverse with:

reverse('app:poll_choice_change', kwargs={'object_id': pk})

With app the default namespace (you can specify a different one if you include this in the path(…) where you attach the admin.urls. poll the name of the app, choice the name of the model in lowercase, and pk the primary key of the object.