[Grok-dev] Trying to understand viewlets
Àlex Magaz Graça
rivaldi8 at gmail.com
Fri Dec 16 19:38:42 UTC 2011
I've just converted my application to use viewlets instead of only
views. After the conversion, some doubts have arisen about which is the
correct way to use them.
Right now, I have all the code in the update() method from the views.
The viewlets don't have any method, only grok directives binding them to
views, viewlet managers and templates.
But, as I see it, it should be the other way round. The code in
Viewlet.update() and only directives in the views. This would allow to
reuse a viewlet in different views. However, I can't bind a viewlet to
more than a View. I've tryied the following, but both fail:
The use case I'm thinking is for example a viewlet that displays a list
of objects. I would want to bind it to a view which only shows this
list, but I would also want to link it to a kind of dashboard view where
it is rendered along with other viewlets showing other information.
I this the correct/usual way of using viewlets?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Grok-dev