Re: Templatetag - using date and join together?

2011-02-11 Thread Shawn Milochik
If you don't find a better solution, and you're going to need this
feature frequently, you can always make a custom template tag. It's
not too much work.
http://docs.djangoproject.com/en/1.2/howto/custom-template-tags/

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



Templatetag - using date and join together?

2011-02-10 Thread Victor Hooi
Hi,

I have a list of Python date objects that I'd like to format and string 
together.

I can use the join templatetag to string them together:

{{ date_sequence|join: ", " }}

And I can also use the date templatetag to format them:

{{ date_sequence|date:" M j" }}

However, I can't see to pipe one into the other - I get the errors:

TemplateSyntaxError: Could not parse the remainder: ': "M j"' from 
'date_sequence|join:", "|date: "M j"'

or

TemplateSyntaxError: Could not parse some characters: date_sequence|date|: 
"M j"||join:", "

(My actual code for that second error is {{ date_sequence|date: "M 
j"|join:", " }}, I'm not sure why it looks that way in the error message).

Now, obviously I can just use a for loop and the date templatetag, but the 
above is much more compact, and I would like to understand what's going on 
as well, or how to get it to work (assuming there is a way).

Thoughts?

Thanks,
Victor

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