Django admin add/change page customization


I have a model and admin page for that model.
However, I want to add a button besides or below one of the fields so that I can provide a more elegant way to edit that field. That field is actually a JSON field.
So I want to add a button and when the button is clicked, the user is redirected a new page on a new tab or window, and user goes through the wizard pages and finally the result is updated back to the original add/change page to that corresponding field.
I am totally new to this so wondering how I can do that.
Any help would be appreciated.

You’ve got a couple different options.

That button being added would then need to call the JavaScript necessary to perform the other actions you describe.

1 Like

Thanks @KenWhitesell
My another question is how can I get value back from the additional page linked to the button.
So I added a button called Compose and that button brings the user to a separate page which will show wizards to input some data.
At the end of that wizard page, once user complete inputs, I need to get the value(JSON) from the page and need to set it back to django admin change/add page to that JSON field before I click on Save button.

If you’re doing this all through the browser, then it’s up to your JavaScript to do that.
Whatever action is taken to send you back to the “main page” would be responsible for moving the data from that wizard back into that field on the original form.

1 Like