Is there a way to pass a template variable into a custom template
tag?  For example, say that my template is rendered like this, so that
books is in the context:

books = books.objects.all()
return render_to_response(template.html, {
  "books":books
 } context_instance=RequestContext(request)

Now say inside my template I want to do something like this:

{% for book in books %}
  {% getBookInfo book %}
{% endfor %}

The idea being that getBookInfo is going to return some html that
describes the book.

However, I find that the book variable is not expanded.  So when I get
into my getBookInfo custom template tag, the first argument it gets is
just the literal 'book', rather than the book object created by
iterating through books.

This seems like a reasonable thing to want to do - am I approaching it
the wrong way somehow?

Margie

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to