Monday, June 25, 2012

Re: Using now in an if


On Monday, 25 June 2012 13:05:24 UTC+1, Larry....@gmail.com wrote:
I'm trying to use now in an if like this:

{% if value|date:"Ymd" ==  now "Ymd" %}

This is failing with: 'Unused '"Ymd"' at end of if expression.'

If I quote it:

{% if value|date:"Ymd" ==  'now "Ymd"' %}

I don't get the syntax error, but the if does not evaluate to true
when the dates match.

I need to see if the date in {{ value }} is `today' - how can I do that?

-larry

Write a custom "is_today" filter. Two lines of code.
--
DR.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/hf5GL6_DOsUJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate