1👍
Assuming…
- you have a foreign key from panelist to Candidate
- you have defined a filter for Candidate in the panelistAdmin
you can activate that filter by adding a direct lookup in the URL:
def view_panelist(self,obj):
base_url = reverse("admin:ttt_panelist_changelist")
url = f"{base_url}?candidate__id__exact={obj.id}"
return format_html('<a href="{}" class = "default">View Panelist</a>', url)
Source:stackexchange.com