views:

20

answers:

1

Hey all,

The framework i'm using (django admin) pops up a new window when adding new items to the database. I would like to use a light box instead of popping up a new window (fancybox for now), and i'm using the iframe option. However, when i click save in the iframe, a request gets sent to the server, and the server responds with a page contains only the javascript code: opener.dismissAddAnotherPopup(...). This function basically closes the window and refresh the fields in the parent (opener) window. Since i don't have opener set, it returns an error and never closes the iframe. Is there anyway of setting opener on the iframe so that it won't be null?

Thanks a lot!

Jason

A: 

The way to do this is to override the admin view that sends the javascript. These are contained in django.contrib.admin.options: the ModelAdmin.response_add and ModelAdmin.response_change methods. You can simply override these in your model's admin class so that they return the correct fancybox closing code.

Daniel Roseman
Hey Daniel, thank you very much for replying! However, my main problem now is detailed in this post (i would rather not use iframe if possible): http://stackoverflow.com/questions/3071338/managementform-data-is-missing-or-has-been-tampered-with-after-changed-popup-to
FurtiveFelon