diff --git a/.env.debug b/.env.debug index f7e3cad..686c0f2 100644 --- a/.env.debug +++ b/.env.debug @@ -4,4 +4,4 @@ POSTGRES_DB=arrowcounter POSTGRES_USER=arrowcounter POSTGRES_PASSWORD=password SECURITY_KEY=malusa -ALLOWED_HOSTS=192.168.1.201 +ALLOWED_HOSTS=* diff --git a/counter/templates/counter/list.html b/counter/templates/counter/list.html index 4fcda9e..93ebe33 100644 --- a/counter/templates/counter/list.html +++ b/counter/templates/counter/list.html @@ -4,6 +4,7 @@ {% block content %}

Counts

+{% include 'pagination.html' %} @@ -37,6 +38,7 @@ {% endfor %}
+{% include 'pagination.html' %}
diff --git a/counter/templates/pagination.html b/counter/templates/pagination.html new file mode 100644 index 0000000..0781ed3 --- /dev/null +++ b/counter/templates/pagination.html @@ -0,0 +1,47 @@ + diff --git a/counter/views.py b/counter/views.py index 2453a62..f22111b 100644 --- a/counter/views.py +++ b/counter/views.py @@ -30,8 +30,15 @@ def arrow_count_list(request): finish = settings.ITEMS_PER_PAGE + start counts = ArrowCount.objects.order_by('-date') \ .filter(user = request.user)[start:finish] + + pageCount = ArrowCount.objects.filter(user = request.user).count() / \ + settings.ITEMS_PER_PAGE template = loader.get_template('counter/list.html') - return HttpResponse(template.render({'counts': counts}, request)) + return HttpResponse(template.render({ + 'counts': counts, + 'pageCount': pageCount, + 'page': page + }, request)) class NewArrowCount(generic.CreateView): form_class = ArrowCountForm