Curious about ModelAdmin internals.. how the hell does it work

25 views
Skip to first unread message

Michal Plsek

unread,
Sep 1, 2021, 8:44:41 PM9/1/21
to Django users
Hello, I would like to know about this (although I hacked around it, but I am still curious):

if I have model which contains ForeignKey attribute and I am using autocomplete_fields on it, where is the found FK of foreign object saved on ModelAdmin page?
Numerical ID of foreign object represented by usual SELECTBOX is marked using <option selected value=FK>. I understand reasons why this is not done with autocomplete_fields, but I would presume the found value of FK would be saved in some <input type="hidden"> or something like that, which is obviously not.

So, using autocomplete_fields, how can I get the found FK value on page?

Reply all
Reply to author
Forward
0 new messages