Groups
Groups
Sign in
Groups
Groups
Django users
Conversations
About
Send feedback
Help
Using now in an if
52 views
Skip to first unread message
Larry Martell
unread,
Jun 25, 2012, 8:05:24 AM
6/25/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to django...@googlegroups.com
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
Daniel Roseman
unread,
Jun 25, 2012, 8:26:14 AM
6/25/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to django...@googlegroups.com
Write a custom "is_today" filter. Two lines of code.
--
DR.
Larry Martell
unread,
Jun 25, 2012, 10:27:42 AM
6/25/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to django...@googlegroups.com
Thanks for the reply. I ended up doing what I needed in python on the sever.
So I guess there is no way to use now in an if?
Reply all
Reply to author
Forward
0 new messages