So I have a Bookings
model in my django app. I am using django admin to display information about the booking. I want to create a custom url directly from the changelist
view -- (not the change
view).
I want the url to be something like: /admin/bookings/generate_bookings
.
I've registered that url in my model admin by overwriting the get_urls
function. The issue is that django automatically resolves any url that follows the syntax of model_name/<text>
as a detail view url and it assumes whatever is in text
is a primary key of the given model.
As a result I get the error:
booking object with primary key u'random_text' does not exist.
Is there any way to get my custom url to resolve first?