How can I use the add and edit related objects from the admin in my own forms?

I would like to mimic the behaviour of the related widget wrapper with the add, remove, edit, and view buttons for objects that are related, for example:

I have a class Grading, with a ForeignKey field to Payment, and I would like to be able to go to the Grading CreateView and click on a button to make a Payment in a popup, which when completed gets selected into the Grading ForeignKey field (so if I forget to make a payment before trying to make a Grading I don’t have to go back and make one, then the other). Thanks!

This below topic might help you, it also have similar requirements…

Similar requirements, but missing enough detail for my smoothbrain to work out how to implement - if you have any ideas on how implement it do tell!

The way Django do it within it’s admin panel, this kind of thing I’ve not integrated in my projects.

1 Like