In Pyramid, how can I use a different renderer based on contents of context?

前端 未结 2 1532
孤城傲影
孤城傲影 2021-01-05 12:00

I have 3 different product page layouts that I would like to display dependent on the information available about the products. Using traversal I have a class called P

2条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-05 12:30

    I'm not sure if it's the good way to go, but you could probably use request.override_renderer = 'oneproduct.mako'.

    If it is just a different way of displaying your products depending on the quantity, you should do the decision in the template.

提交回复
热议问题