[openstack-dev] [Horizon] Modal form without redirect

Gabriel Hurley Gabriel.Hurley at nebula.com
Wed Aug 28 19:33:58 UTC 2013


If you look at the code in the post()[1] method of the base workflow view you'll note that a response to a successful workflow POST is always a redirect[2] (caveat for when it's specifically adding data back to a field, which isn't relevant here).

The reason for this is that in general when you POST via a standard browser request you want to send back a redirect so that reloading the page, etc. behave correctly and don't potentially result in double-POSTs.

If you're submitting the workflow via a regular HTTP from submit POST then I'd say redirecting is correct; you simply want to redirect to the current page. If you're doing this via AJAX then you'll want to add some new code to otherwise signal a successful response (both to the code and to the user) and to take action accordingly.

Hope that helps,

     - Gabriel

[1] https://github.com/openstack/horizon/blob/master/horizon/workflows/views.py#L130
[2] https://github.com/openstack/horizon/blob/master/horizon/workflows/views.py#L156


> -----Original Message-----
> From: Toshiyuki Hayashi [mailto:hayashi at ntti3.com]
> Sent: Tuesday, August 27, 2013 2:26 PM
> To: OpenStack-dev at lists.openstack.org
> Subject: [openstack-dev] [Horizon] Modal form without redirect
> 
> Hi all,
> 
> I'm working on custmoizing modal form for topology view, I would like to
> prevent redirecting after submitting.
> https://github.com/openstack/horizon/blob/master/horizon/static/horizon/
> js/horizon.modals.js#L110
> According to this code, if there is a no redirect_header, the modal form won't
> redirect. But I couldn't figure out how to remove redirect information from
> http header.
> For example, if I want to remove redirect from LaunchInstance
> https://github.com/openstack/horizon/blob/master/openstack_dashboard/
> dashboards/project/instances/workflows/create_instance.py#L508
> How should I do that?
> I tried "success_url = None", but it doesn't work.
> 
> If you have any idea, that would be great.
> 
> Regards,
> Toshiyuki
> 
> _______________________________________________
> OpenStack-dev mailing list
> OpenStack-dev at lists.openstack.org
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev



More information about the OpenStack-dev mailing list