nrubin29 nrubin29 - 1 year ago 154
Python Question

Django Embed Admin Form

I am trying to embed the exact form that appears in the Django admin when I edit a model in a different page on my website. My plan is to have an Edit button that, when clicked, displays a modal with the edit page inside of it.

The issue with using a ModelForm is that this particular model has two generic foreign keys. The admin handles this perfectly, providing the ability to add, edit, or remove these objects. If I could embed the admin page (with its HTML or perhaps my own), that would be all I need.


Answer Source

I fixed the issue by using an iframe to embed the page itself. I used the ?_popup=1 argument so that the navbar and other parts of the admin site wouldn't show up.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download