On 21 jan, 00:32, Andrew Ingram <[email protected]> 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/


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" 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/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to