On 06/26/2014 06:00 PM, e.generalov wrote:
> Hello!
> 
> In my AngularJs application I want to reuse some django admin forms (to
> "add", "edit" and "delete" orders) 
> but show them in the iframe instead of popup windows.
>  
> In order to display "add" form in iframe I create a template:
> 
>     <iframe src="/admin/order/order/add/?_popup=1" width="300"
>     height="200"></iframe>
>     <script>
>         window.dismissAddAnotherPopup = function
>     customDismissAddAnotherPopup(window, val, obj) {
>         };
>     </script>
> 
> 
> And redefine admin/popup_response.html template to search
> dissmissAddAnotherPopup function in the window.parent (that is in
> iframe) too:
> 
>     <!DOCTYPE html>
>     <html>
>       <head><title></title></head>
>       <body>
>         <script type="text/javascript">
>           (window.opener ||
>     window.parent).dismissAddAnotherPopup(window, "{{ value }}", "{{ obj
>     }}");
>         </script>
>       </body>
>     </html>
> 
> 
> When user submit "add" form in the iframe then django responds with
> `admin/popup_response.html` template 
> and my JavaScript application takes notification
> from dismissAddAnotherPopup function. 
> It works as expected.
> 
> I have a trouble then try to implement the same logic for "edit" and
> "delete" forms (/admin/order/order/1/?_popup=1 and
> /admin/order/order/1/delete/?_popup=1 urls). 
> When user submit form data then Django responds with redirect to usual
> list of objects instead of admin/popup_response.html.
> 
> The difference is in implementation. The render_add method
> (https://github.com/django/django/blob/master/django/contrib/admin/options.py#L1081)
> takes in considiration IS_POPUP_VARinrequest.POST and
> renders admin/popup_response.html template when _popup parameter is
> present. 
> But the response_change
> (https://github.com/django/django/blob/master/django/contrib/admin/options.py#L1128)
> and response_delete
> (https://github.com/django/django/blob/master/django/contrib/admin/options.py#L1271)
>  methods
> does not. It was unexpected for me.
> 
> The delete_viewmethod does not hides decoration (breadcrumbs and footer)
> then _popup is present (/admin/order/order/1/delete/?_popup=1). It was
> unexpected for me too.
> 
> Do you assess these features as errors and will you accept a PR to
> correct them?

You might be interested in django-admin2, which should be considerably
easier to integrate with AngularJS because it has REST API built in.

https://github.com/pydanny/django-admin2

> -- 
> You received this message because you are subscribed to the Google
> Groups "Django developers" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to [email protected]
> <mailto:[email protected]>.
> To post to this group, send email to [email protected]
> <mailto:[email protected]>.
> Visit this group at http://groups.google.com/group/django-developers.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-developers/5ae48bd4-4aba-4b03-8d54-baf2b279c08d%40googlegroups.com
> <https://groups.google.com/d/msgid/django-developers/5ae48bd4-4aba-4b03-8d54-baf2b279c08d%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/53ACECAF.4070506%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to