-
- # Views.py
-
- @csrf_exempt
- def stats(request):
- obj = statistics.objects.filter(username='user_n1', action='FOLLOW').order_by('-id')[:1]
- template = loader.get_template('statistics.html')
- context = {
- 'obj':obj
- }
- return HttpResponse(template.render(context, request))
-
- # statistics.html file
-
- {% if obj %}
- <ul>
- {% for statistics in obj %}
- <div class = "user_table">
- <li>{{ statistics.username }}<br>
- {{ statistics.action }}<br>
- {{ statistics.count_actions }}<br>
- {{ statistics.date }}<br>
- </li>
- {% endfor %}
- </ul>
- {% else %}
- <p>No stats are available.</p>
- {% endif %}
- </div>
-
-
-
- # My question how could I subtract datenow from date from sql?
- # I do not know how can I access the date column from all these
-