diff --git a/ArticlesApp/funcs.py b/ArticlesApp/funcs.py index ec356b5..2f00cab 100644 --- a/ArticlesApp/funcs.py +++ b/ArticlesApp/funcs.py @@ -1,6 +1,8 @@ from .models import * +elements_on_page = 2 + def get_articles(art_kwargs, request_Data=None, from_el=None, to_el=None): if request_Data: @@ -27,10 +29,16 @@ def get_articles(art_kwargs, request_Data=None, from_el=None, to_el=None): if not to_el or to_el >= el_count: last_block = True + if el_count - to_el > elements_on_page: + next_page_els_count = elements_on_page + else: + next_page_els_count = el_count - to_el + Dict = { 'articles': arts, 'last_block': last_block, - 'last_el': to_el + 'last_el': to_el, + 'next_page_els_count': next_page_els_count } return Dict diff --git a/ArticlesApp/views.py b/ArticlesApp/views.py index 735532c..ea4f70c 100644 --- a/ArticlesApp/views.py +++ b/ArticlesApp/views.py @@ -79,6 +79,9 @@ def ArticlesPageView(request, year=None): Dict = get_articles(art_kwargs=kwargs) + Dict.update({ + + }) t = loader.get_template('pages/p_articles.html') return get_inter_http_respose(t, Dict, request)