0.7.87
articles paging
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user