On Saturday 21 of September 2013 19:22:27 Anand Chitipothu wrote: > On Sat, Sep 21, 2013 at 7:07 PM, Klerik <[email protected]> wrote: > > hi guys, > > > > I have one big problem. I need in my base teplate dynamically render my > > categories (my web is blog with categories - http://www.klerik.cz [this > > is old > > production version with staticaly rendered categories - in left column]). > > So I create one global variable with this code: > > > > web.template.Template.globals['seznam_kategorii'] = > > databaze.select("kategorie", order="cislo ASC") > > > > and on base.html I only print with for cycle all categories and all works > > great: > > > > $for kategorie in seznam_kategorii: > > <a href="/kategorie/"$kategorie.url_kategorie>$kategorie.kategorie</a> > > > > bud this work only 1 times! when I make page refresh, then the categories > > are > > gone (only empty space - like nothig in code). > > > > Is here solution for me? > > The issue is with > databaze.select("kategorie", order="cislo ASC") > > It returns an iterator, which is consumed after first use. Change that to > the following to fix the issue. > databaze.select("kategorie", order="cislo ASC").list() > > Anand
Wow Anand, simple and easy solution :). Thank You very much for your help and quick response :). -- Klerik -- You received this message because you are subscribed to the Google Groups "web.py" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/webpy. For more options, visit https://groups.google.com/groups/opt_out.
