[Product-Developers] Change view programmatically

Eric Bréhault ebrehault at gmail.com
Tue Aug 12 20:37:26 UTC 2008


hello,

this should work:
self.setLayout("yourview")

but if you just want to redirect to a specific view, you do not
necessarily need to modify the default layout, you may just call the
view:
REQUEST.RESPONSE.redirect(self.absolute_url()+"/yourview")

eric

On Tue, Aug 12, 2008 at 9:39 PM, cswank <craig_swank at nrel.gov> wrote:
>
> Hello All,
> When you change the view of a content item (via the 'Display' drop down),
> the selected view is stored and used the next time the content is visited.
> My question is, how can I change the view programmatically?
>
> I have a content item that has a formlib form as its default view.  When the
> user submits the form, I want the browser to redirect to the same content
> item, but now with a different view.  The chosen view is based on the user's
> input into the form.
>
> Craig
>
>
>
> --
> View this message in context: http://n2.nabble.com/Change-view-programmatically-tp720329p720329.html
> Sent from the Product Developers mailing list archive at Nabble.com.
>
>
> _______________________________________________
> Product-Developers mailing list
> Product-Developers at lists.plone.org
> http://lists.plone.org/mailman/listinfo/product-developers
>




More information about the Product-Developers mailing list