Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 662951
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T23:26:08+00:00 2026-05-13T23:26:08+00:00

I’m not sure why, but this condition will never evaluate True for me. I’m

  • 0

I’m not sure why, but this condition will never evaluate True for me. I’m feeding it datetime.today() in the urls file. Am I missing something?

Template:

{% load humanize %}

{{ entry.date|naturalday }}  {# Evals to "today" #}

{% ifequal entry.date|naturalday "today" %}
    True
    {{ entry.date|date:"fA"|lower }} {{ entry.date|naturalday|title }}
{% else %}
    False
    {{ entry.date|naturalday|title }}
{% endifequal %}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T23:26:08+00:00Added an answer on May 13, 2026 at 11:26 pm

    I just tested this under Django 1.1.1 and it works just fine for me.

    Which version of Django are you running?

    However, there are a few other issues that could be causing you problems:

    1. I also noticed that in your question you have {% load humaize %}, which contains a typo (should be {% load humanize %}). I’m not sure if this is in your real code or just in your question though.

    2. If you are really using datetime.today() in your urls.py, as you say, please be aware that this could cause problems, since the value is only going to be calculated once, when the extra_context dictionary is first created (since the value of "today" will only ever be calculated once). This could mean the code will work on the first day the app is running, then fail the second day. You likely wouldn’t notice this until you deploy to an environment where the app runs overnight without being restarted.

      If you want it to really be "today", just pass in the function datetime.today rather than datetime.today(). That way the template will call it on each render.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.