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 would take about 5 minutes in Rails (and I don't like Rails), it
would take about 10 minutes in Tapestry (a Java framework which I
despise). So I'm hoping there's a nice elegant way of doing this in
Django because the only approach I can think of is very unappealing.
Regards,
Andrew Ingram
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---