Hi,

Another thing I forgot to mention are macros which can be used for something very similar:

_widgets.html

   {% macro last_tweets(count=20) %}
     <div class=twitter>
     {% for tweet in models.twitter.get_last_tweets(count) %}
       <p><a href="{{ tweet.url|e }}">{{ tweet.username|e }}</a>:
          {{ tweet.parsed_text }}
     {% endfor %}
     </div>
   {% endmacro %}

And there where you want do display it:

   {% from "_widgets.html" import last_tweets %}
   {{ last_tweets() }}


Just makes sure that you pass some sort of object to the global dict that the templates can use to access the data (for example a the module with all your models).

Regards,
Armin

--
You received this message because you are subscribed to the Google Groups 
"pocoo-libs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pocoo-libs?hl=en.

Reply via email to