Out in the weeds here trying to figure out how to limit attached admin page to ONLY show related objects that have already been set rather than all objects in a many-to-one relationship. In the screenshot, only the last two collections relate to this particular institution. Obviously a newbie here. I’ve come so far, but after a few hours, I’m giving up on a solution.
Are you saying you don’t want an admin to be able to add or remove those entries? (If you want them to be able to add new relationships, the admin page needs to show them all.)
If so, (you don’t want any changes made to those relationships here), you could either make the field read-only, or you could not include it at all, or you could create a Custom Admin class with a custom formfield_for_foreignkey function.
Note: I’d also like to point out that the built-in admin facility really isn’t intended to be a general-purpose access method for people using your site. It’s really intended to only be used by your system admins who may need to make data changes that aren’t intended to be made by “normal” users.
See the first paragraph of the Django Admin site documentation page.
Ken, thanks so much for sharing your expertise. I realize that admin, as you’ve reminded me, is not intended to be used by normal users. I just thought there might be a painless way to have admin page for each institution to show only collections connected to that institution. I wouldn’t want a user to be able to add additional ones there, but I would expect to be able to edit related collections already set there. Reiterating that I’m new to both Python and Django, so I really appreciate experts’ guidance. I feel I’ve conquered the world even to get my data models figured out!
Head of the Research Library
Amon Carter Museum of American Art
3501 Camp Bowie Blvd., Fort Worth, TX 76107