title: How to add today's date to django templates
body: <p>I researched how I could pass in a datetime object to my templates, but none of them seems to work. Here is the code for my view:</p>
  <pre><code>class LeadListView(LoginRequiredMixin, generic.ListView):
      # some other code
      today_date = datetime.date.today()
  
      def get_context_data(self, **kwargs):
          context = super(LeadListView, self).get_context_data(**kwargs)
          context['today_date'] = self.today_date
          return context
  </code></pre>
  <p>However, when I try to use the <code>today_date</code> in the template, it doesn't work. I am trying to use the <code>today_date</code> so that I might use it in an if statement to see if today's date is between two other datetime variables. Thanks a lot!</p>
  <p>Some additional information on how the django template looks like:</p>
  <pre><code>{% if lead.class_start_date &lt;= today_date and lead.class_end_date &gt;= today_date %}
  {% endif %}
  </code></pre>
  <p>Here, <code>class_start_date</code> and <code>class_end_date</code> are just part of the Lead model.</p>
  <p>This is the full list view:</p>
  <pre><code>class LeadListView(LoginRequiredMixin, generic.ListView):
      tempalte_name = &quot;leads/lead_list.html&quot;
      context_object_name = &quot;leads&quot;
  
      def get_queryset(self):
          user = self.request.user
  
          # initial queryset of leads for the entire organisation
          if user.is_organisor:
              queryset = Lead.objects.filter(
                  organisation=user.userprofile,
                  agent__isnull=False
              )
          else:
              queryset = Lead.objects.filter(
                  organisation=user.agent.organisation, 
                  agent__isnull=False
              )
              #filter for the agent that is logged in
              queryset = queryset.filter(agent__user=user)
          return queryset
  </code></pre>