try this... its complete tutorial which include template tags too.. will help you to understand
http://www.webmonkey.com/tutorial/Use_Templates_in_Django greetings, Puneet On Wed, Jan 21, 2009 at 2:13 PM, bruno desthuilliers < bruno.desthuilli...@gmail.com> wrote: > > On 21 jan, 00:32, Andrew Ingram <a...@andrewingram.net> wrote: > > I'm building a simple banner/promotion system for a site. Aside from a > > few date-related fields, a banner consists of: > > - an image > > - a target url > > - the image dimensions > > - some tags (using django-tagging) > > > > I'm trying to figure out how to build a template-tag to allow me to > > display a number of banners based on their properties. > > > > i.e > > > > {% get-banners max-width='450' max-height='100' min-height='50' > > match-any='foo, bar' match-all='homepage' limit='2' as banners %} > > > > {% for banner in banners %} > > <a href="{{ banner.redirect_url }}"><img src="{{ banner.image }}"></a> > > {% endfor %} > > > > The only way I can see to do this is to write a hideous parser function, > > made worse by the fact that almost all of the arguments are optional. > > This may help: > http://www.djangosnippets.org/snippets/1293/ > > > > > -- If you spin an oriental man, does he become disoriented? (-: ¿ʇɥǝɹpɹǝʌ ɟdoʞ uǝp ɹıp ɥɔı ,qɐɥ 'ɐɐu is der net süß » ε(●̮̮̃•̃)з -----PM --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---