articles paging
This commit is contained in:
SDE
2023-10-05 19:42:13 +03:00
parent 63d3ffddd4
commit 32f65de458
7 changed files with 11 additions and 6 deletions

View File

@@ -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

View File

@@ -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'),
] ]

View File

@@ -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,

View File

@@ -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'),
] ]

View File

@@ -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

View File

@@ -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 %}