3

I have a Jinja template where I want to display a message for users that were created before a specified date. I only have control over the template file. What are my options to accomplish something like the following.

{% if sub.start_date < datetime.datetime(2015,09,30) -%}
    Hello Early Members!
{% endif -%}

Obviously the code above does not work since datetime will not be recognized. So what are my options here?

JustMaier
  • 2,101
  • 21
  • 23
  • dont they have a filter something like `{{"10-15-2015"|parsedate:"%m-%d-%Y" }}` – Joran Beasley Sep 11 '15 at 20:50
  • you could also use a javascript function and the javascript Date class – Joran Beasley Sep 11 '15 at 20:53
  • Doesn't look like they have a `parsedate` filter. I went ahead and toggled an element using javascript, but that's kinda hacky and it makes me feel dirty... I'm still wondering if there is a better solution out there. – JustMaier Sep 11 '15 at 20:58
  • there is always a better solution ... just change the view function to have a true false flag :P – Joran Beasley Sep 11 '15 at 21:18
  • Ask whoever controls the template invocation code to give you access. Or at least add what you need :-) – Cameron Sep 11 '15 at 22:19

0 Answers0