title: Display time stored in database in HTML (django)
body: <p>I'm building a bus booking website using Django. Users fill From, To, Bus type(ordinary or Volvo) and date. Results display the buses available on that route on that particular date. I made three tables - Bus, Route, and Frequency. You can check my models.py and views.py here - <a href="https://dpaste.de/Oi6a" rel="nofollow noreferrer">https://dpaste.de/Oi6a</a>                     I convert the date to the corresponding day of the week. I have filtered out the buses, However, I want to display time on the template. This is part of my views.py code:</p>
  
  <pre><code>def select(request):
  
      bus_type = request.GET.get('bus_type')
      bus_from = request.GET.get('bus_from')
      bus_to = request.GET.get('bus_to')
  
      date_string = request.GET.get('date')
      date = datetime.strptime(date_string, '%Y-%m-%d')
  
      day = calendar.day_name[date.weekday()]
  
      kwargs = { '{0}__range'.format(day): ["00:00:00", "23:59:59"],}
  
  
      qs = Frequency.objects.filter(bus__type_of_bus=bus_type, bus__route__location_from=bus_from, bus__route__location_to=bus_to, **kwargs)
  
      context = {'qs': qs, 'date':date_string,}
      template = 'select.html'
      return render(request, template, context)
  </code></pre>
  
  <p>As you can see qs filters the buses available and is then passed to the template. This is a part of the template:</p>
  
  <pre><code>&lt;div id="pricing-table" class="clear"&gt;
      {% for info in qs %}
      &lt;div class="price_block"&gt;
          &lt;h3&gt;{{ info.bus.type_of_bus }}&lt;span&gt;{% if info.bus.type_of_bus == 'Volvo' %} Rs 550 {% else %}Rs 330 {% endif %}&lt;/span&gt;&lt;/h3&gt;
          &lt;a href="{% url 'book:seats' %}"rel="follow" rel="noreferrer" class="signup" type="submit"&gt;Book&lt;/a&gt;
          &lt;ul&gt;
              &lt;li&gt;&lt;b&gt;Bus Number -&lt;/b&gt; {{ info.bus.bus_number }}&lt;/li&gt;
              &lt;li&gt;&lt;b&gt;Route -&lt;/b&gt; {{ info.bus.route }}&lt;/li&gt;
              &lt;li&gt;&lt;b&gt;Date -&lt;/b&gt; {{ date }}&lt;/li&gt;
              &lt;li&gt;&lt;b&gt;Time -&lt;/b&gt; {{ info.day }}&lt;/li&gt;
          &lt;/ul&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p>In the last line of this HTML file, I have added info.day. What I want is that this displays the time that bus operates on the given day. For example, If a person searches a bus on 29th April. 29th April will be converted to corresponding day i.e. Friday. The frequency table has 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday' and 'Sunday' as attributes and these all are TimeField(). qs filters the buses and passes to the template. I want {{ info.day }} to show the time when the bus operates. Instead, it shows nothing. But when I change {{ info.day }} to {{ info.Friday}} it start showing the time. How can I display the time without having to manually go and change the day in {{ info.(here) }} every time I search for a bus. I didn't make it very clear, but I hope you understand. Let me know if you don't.</p>