开发者

Django admin output extra HTML in ModelSite

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 }}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜