title: Django template check if current time falls between start and end times
body: <p>I have 2 fields in my model named <strong>Restaurant</strong> as follows:</p>
  
  <pre><code>start_time = models.TimeField(blank=True)
  end_time = models.TimeField(blank=True)
  </code></pre>
  
  <p>I have a view in which i am filtering my model to give a list to my template as follows:</p>
  
  <pre><code>restaurants = Restaurant.objects.filter(location__icontains = location)
  return render_to_response('restaurant.html', { 'user': request.user, 'restaurant': restaurants }, RequestContext(request))
  </code></pre>
  
  <p>and in my template i have:</p>
  
  <pre><code>{% if restaurant %}
      &lt;ul class="list-group"&gt;
          {% for r in restaurant %}
              &lt;li class="list-group-item"&gt;
                  &lt;h5&gt;
                      &lt;legend&gt;{{ r.restaurant_name|capfirst }}&lt;/legend&gt;
                      &lt;a href="/order/#/showmenu/{{ r.id }}" type="button" class="btn btn-primary pull-right"&gt;View Menu&lt;/a&gt;
                  &lt;/h5&gt;
              &lt;/li&gt;
          {% endfor %}
      &lt;/ul&gt;
  {% endif %}
  </code></pre>
  
  <p>I am trying to look if there is a template tag that can be useful to check if the <em>current time</em> falls between my <code>start_time</code> and <code>end_time</code>, then show the <code>View Menu</code> button, else not show. </p>
  
  <p>i have gone through the documentation if i could find one but maybe i missed it. Any help will be appreciated.</p>
  
  <p>Try 1:</p>
  
  <pre><code>&gt;&gt;&gt; s = Restaurant.objects.all()
  &gt;&gt;&gt; s[0].is_open()
  Traceback (most recent call last):
    File "&lt;console&gt;", line 1, in &lt;module&gt;
    File "/Users/xxx/myapp/models.py", line 64, in is_open
      return self.start_time &lt;= datetime.datetime.now().time &lt; self.end_time
  TypeError: can't compare datetime.time to builtin_function_or_method
  </code></pre>