Reputation: 25557
I see this pattern used very often!
Any idea how this works?
by popup I mean an actual window popup, rather than a modal window. A modal window could work nicely though I reckon.
Upvotes: 0
Views: 3092
Reputation: 599610
The only way to do this is with Javascript. Django's own admin includes a (fairly clunky) example: when you save the popup, it returns a response consisting of just a <script>
tag containing Javascript which references the box in the parent form. See for example django.contrib.admin.options.ModelAdmin.response_add
.
Upvotes: 1
Reputation: 9174
Do you want something like this ?
http://jqueryui.com/demos/dialog/#modal-form
http://jqueryui.com/demos/dialog/modal-form.html
You can validate the form with js / jquery and then do an ajax call and post the data to the server
Upvotes: 3
Reputation: 2426
You can use somethign like facebox to create the popup. This requests a page to the server (your form). Once submitted, detect that the facebox was closed (see the API) and make a new ajax request to the server that will return the needed data to populate your page.
Upvotes: 0