0.7.54
articles paging
This commit is contained in:
@@ -29,7 +29,8 @@ def get_articles(art_kwargs, request_Data=None, from_el=None, to_el=None):
|
|||||||
|
|
||||||
Dict = {
|
Dict = {
|
||||||
'articles': arts,
|
'articles': arts,
|
||||||
'last_block': last_block
|
'last_block': last_block,
|
||||||
|
'last_el': to_el
|
||||||
}
|
}
|
||||||
|
|
||||||
return Dict
|
return Dict
|
||||||
|
|||||||
@@ -5,6 +5,6 @@ from django.urls import path
|
|||||||
from .js_views import *
|
from .js_views import *
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('get_articles_block/', get_articles_block_ajax, name='get_articles_block_ajax'),
|
|
||||||
|
|
||||||
]
|
]
|
||||||
@@ -33,7 +33,7 @@ def get_articles_block_ajax(request):
|
|||||||
if 'errors' in Dict:
|
if 'errors' in Dict:
|
||||||
return JsonResponse(Dict, status=400)
|
return JsonResponse(Dict, status=400)
|
||||||
|
|
||||||
html = render_to_string('blocks/b_news_elements.html', Dict, request=request)
|
html = render_to_string('blocks/articles/b_news_elements.html', Dict, request=request)
|
||||||
|
|
||||||
res_Dict = {
|
res_Dict = {
|
||||||
'html': html,
|
'html': html,
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
from django.urls import path
|
from django.urls import path
|
||||||
from .views import *
|
from .views import *
|
||||||
|
from .js_views import *
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('articles/', ArticlesPageView, name=u'articles'),
|
path('articles/', ArticlesPageView, name=u'articles'),
|
||||||
path('articles/<int:year>/', ArticlesPageView, name=u'articles_by_year'),
|
path('articles/<int:year>/', ArticlesPageView, name=u'articles_by_year'),
|
||||||
path('article/<str:art_url>/', ArticlesOnePageView, name=u'article_one'),
|
path('article/<str:art_url>/', ArticlesOnePageView, name=u'article_one'),
|
||||||
path('info_page/<str:page_url>/', UserPageView, name=u'user_page'),
|
path('info_page/<str:page_url>/', UserPageView, name=u'user_page'),
|
||||||
|
|
||||||
|
path('get_articles_block/', get_articles_block_ajax, name='get_articles_block_ajax'),
|
||||||
]
|
]
|
||||||
@@ -200,7 +200,7 @@ def get_routes_Dict(user=None, data=None):
|
|||||||
routes = routes[:to_el]
|
routes = routes[:to_el]
|
||||||
else:
|
else:
|
||||||
to_el = 25
|
to_el = 25
|
||||||
routes = routes[:25]
|
routes = routes[:to_el]
|
||||||
|
|
||||||
last_block_routes = False
|
last_block_routes = False
|
||||||
if not to_el or to_el >= routes_count:
|
if not to_el or to_el >= routes_count:
|
||||||
@@ -231,7 +231,8 @@ def get_routes_Dict(user=None, data=None):
|
|||||||
|
|
||||||
res_Dict.update({
|
res_Dict.update({
|
||||||
'routes': routes,
|
'routes': routes,
|
||||||
'last_block_routes': last_block_routes
|
'last_block_routes': last_block_routes,
|
||||||
|
'last_el': to_el
|
||||||
})
|
})
|
||||||
return res_Dict
|
return res_Dict
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
{% with from_el=3 %}
|
{% with from_el=3 %}
|
||||||
{% include 'blocks/static_pages_blocks/b_news_elements.html' %}
|
{% include 'blocks/articles/b_news_elements.html' %}
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
{# boris edited #}
|
{# boris edited #}
|
||||||
{% if last_block == False %}
|
{% if last_block == False %}
|
||||||
|
|||||||
Reference in New Issue
Block a user