[Answer]-Reversing complex Admin URLs from templates

1👍

I was looking at this the wrong way. While:

{% url admin:billing_creditcardtoken_add %}?customer={{ user.id }}

…might be somewhat ugly, the only thing added syntax would serve to do is try to construct a query string, which isn’t something one reverses URLs to do normally anyway. So this is an acceptable method of accomplishing this task.

What I was looking for in the second turned out to be:

{% url admin:billing_creditcardtoken_changelist %}?customer={{ user.id }}

changelist, as it turns out, does not show a history of changes, but creates a list of possible items to change. Adding the query string applies the proper filter I needed.

Leave a comment