[Answered ]-Django admin cannot carryover object from one page to another admin page

1👍

Assuming…

  1. you have a foreign key from panelist to Candidate
  2. 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)

Leave a comment