Ultimately, I want to add an <iframe>
to the display of a particular model on Django's admin page. Django is already rendering the form for this model correctly, but I want to add this <iframe>
in addition to Django's form. The src
attribute needs to involve the primary key for the currently-displayed record.
I've learned how to properly override the change_form.html
template through Django's documentation, and I can add markup to the right block, but I can't figure out how to access the primary key value. (No amount of determined Googling ha开发者_开发百科s helped at all.)
Alternatively, is there a direct way to specify that I want to produce extra output in my ModelSite
definition?
Overriding "change_form.html" is the right way to go. You can access the current object with
{{ original }}
精彩评论