0.7.87
articles paging
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
from .models import *
|
from .models import *
|
||||||
|
|
||||||
|
|
||||||
|
elements_on_page = 2
|
||||||
|
|
||||||
def get_articles(art_kwargs, request_Data=None, from_el=None, to_el=None):
|
def get_articles(art_kwargs, request_Data=None, from_el=None, to_el=None):
|
||||||
|
|
||||||
if request_Data:
|
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:
|
if not to_el or to_el >= el_count:
|
||||||
last_block = True
|
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 = {
|
Dict = {
|
||||||
'articles': arts,
|
'articles': arts,
|
||||||
'last_block': last_block,
|
'last_block': last_block,
|
||||||
'last_el': to_el
|
'last_el': to_el,
|
||||||
|
'next_page_els_count': next_page_els_count
|
||||||
}
|
}
|
||||||
|
|
||||||
return Dict
|
return Dict
|
||||||
|
|||||||
@@ -79,6 +79,9 @@ def ArticlesPageView(request, year=None):
|
|||||||
|
|
||||||
|
|
||||||
Dict = get_articles(art_kwargs=kwargs)
|
Dict = get_articles(art_kwargs=kwargs)
|
||||||
|
Dict.update({
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
t = loader.get_template('pages/p_articles.html')
|
t = loader.get_template('pages/p_articles.html')
|
||||||
return get_inter_http_respose(t, Dict, request)
|
return get_inter_http_respose(t, Dict, request)
|
||||||
|
|||||||
Reference in New Issue
Block a user