[openstack-dev] Horizon Issue

K S khyatitp at gmail.com
Thu Nov 14 00:09:11 UTC 2013


Thank you for your reply Priti.

However, I am looking to pass variables on successful execution of a
workflow to another chained view/redirect to another view (to be more
specific ModalFormView). I cannot pass these variables via url, as I
intend to pass sensitive information (for instance password). Please
let me know if you know of any alternate solution.

Thank you.

On Tue, Nov 12, 2013 at 11:21 PM, Priti Sarap <priti.sarap at gslab.com> wrote:
> Hello K S,
>
> The answer to your question is Yes. You can pass parameters from workflows
> to views.
> You need to write few functions in workflow class and few in views class. I
> have given sample example as below:
>
> In Workflows: write a expected function passing the expected parameters:
> Class Workflow(workflows.Workflow):
>
> def func(self):
>         parameters = <parameters to be passed>
>         return parameters
> In Views:
> class WorkflowView(workflows.WorkflowView):
>     workflow_class = Workflow
>
>     def get_initial(self):
>         initial = super(Workflow, self).get_initial()
>         initial['project_id'] = self.request.user.tenant_id
>         initial['user_id'] = self.request.user.id
>         return initial
> // You need to write below two new functions in view class.
>     def get_workflow(self):
>         extra_context = self.get_initial()
>         entry_point = self.request.GET.get("step", None)
>         workflow = self.workflow_class(self.request,
>                                        context_seed=extra_context,
>                                        entry_point=entry_point)
>         return workflow
>
>     def get_context_data(self, **kwargs):
>         context = super(WorkflowView, self).get_context_data(**kwargs)
>         workflow = self.get_workflow()
>         parameters = workflow.func() //(function writen in workflows) here
> you get parameters from workflows
>         return parameters
>
> I think this should solve your problem.
>
> Thanks,
> Priti Sarap.
>



More information about the OpenStack-dev mailing list