# -*- coding: utf8 -*- from .models import * from datetime import datetime, date from django.http import Http404, HttpResponse from django.template import loader # from django.contrib.auth.decorators import login_required # from BaseModels.search_optimization.ld_json.ld_article_news import get_ld_article_news # from django.contrib.sites.shortcuts import get_current_site def get_flat_pages_links_Dict(site): flat_pages_links = UserPageModel.objects.filter( url__in=('about-truenergy', 'for-partners', 'contacts'), sites=site ).values_list('url', flat=True) return {'flat_pages_links': flat_pages_links} def get_article_breadcrumbs(request, art): # print('get_article_breadcrumbs') half_count = art.articlesCountInBlock / 2 art_List = ArticleModel.objects.filter(enable=True, article_DT__gte=art.article_DT).order_by( 'article_DT')[:half_count] artListDown = ArticleModel.objects.filter(enable=True, article_DT__lt=art.article_DT).order_by( '-article_DT')[:art.articlesCountInBlock-len(art_List)] if len(artListDown)