If you understand correctly, you want to add a custom field ( called in your ModelAdmin list_display list ) to your change list in the CampaignAdmin campaign.
Your custom field will be a link that accepts the category.id of each category in your change list and creates a link to the desired, filtered admin view , which is apparently an account-change_list in your case:
admin/yourproject/account/?category__id__exact=<category.id>
Assuming the category is a field in your campaign model, you can add the following method to your CampaignAdmin:
def account_link(self, obj): return '<a href="/admin/yourproject/account/?category__id__exact=%s">Accounts</a>' % (obj.category.id) account_link.allow_tags = True
And then add it to the admin list_display parameter:
list_display = ('account_link', ...)
It depends a little on your data model.
If you want to create a permanent, filtered change list view that suits your needs, you can take a look at this article: http://lincolnloop.com/blog/2011/jan/11/custom-filters-django-admin/
source share