On Fri, Aug 27, 2010 at 9:22 AM, Yo-Yo Ma <baxterstock...@gmail.com> wrote: > I see what you're saying Russell. I myself am reluctant to use the > template tag I created in some ways. Although I cannot seem to find a > DRY way of doing what I'm doing
Factor the logic out of your template so that your template is just describing the display, not the logic determining what is displayed. It looks like you want to pick "the one" out of a list. This suggests to me that your view should be putting "the one" into the template context that is being rendered. If this calculation is something that is performed regularly and you want to make sure every template has that "the one" available for rendering, write a template preprocessor that inserts the value into the context. If "the one" is logic that extracts the right object from a different list, depending on the view, write a template tag that captures the broader idea (i.e., follow the lead of contrib.comments and it's {% get_comment_form for X as Y %} template tag). There are lots of ways it can be done without putting programming logic in your template. Yours, Russ Magee %-) -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-develop...@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.