-
- #VIEW
- def stats(request):
- obj = statistics.objects.filter(ig_username='user_number_one', action='FOLLOW').order_by('-id')[:1]
- template = loader.get_template('statistics.html')
- context = {
- 'obj':obj
- }
-
- #obj has 5 columns: id, ig_username, action, count_actions, date
-
- return HttpResponse(template.render(context, request))
-
- #TEMPLATE
-
- {% if obj %}
- <ul>
- {% for statistics in obj %}
- <div class = "user_table">
- <li>{{ statistics.ig_username }}<br>
- {{ statistics.action }}<br>
- {{ statistics.count_actions }}<br>
- {{ statistics.date }}<br>
- </li>
- {% endfor %}
- </ul>
- {% else %}
- <p>No stats are available.</p>
- {% endif %}
- </div>
-
- how could I subtract datetime.datetime.now with statistics.date ?
-