0.0.25 services services_view_scheme

This commit is contained in:
SDE
2023-11-28 16:47:26 +03:00
parent ba1d796e88
commit 6cc94487c4
3 changed files with 27 additions and 14 deletions

View File

@@ -3,4 +3,21 @@ from .models import *
def get_sections(): def get_sections():
sections = Section.objects.filter(enable=True).order_by('order') sections = Section.objects.filter(enable=True).order_by('order')
return sections return sections
def get_section_views_Dict(section):
services = section.rel_services_for_section.filter(enable=True).order_by('order')
services_view_scheme = '2_cols_wo_group'
for service in services:
if service.rel_children_for_service.filter(enable=True):
services_view_scheme = '3_cols_w_group'
break
Dict = {
'sections': get_sections(),
'services': services,
'services_view_scheme': services_view_scheme,
}
return Dict

View File

@@ -38,9 +38,7 @@ def get_content_for_section_ajax(request):
section = Section.objects.get(url=data['section_url']) section = Section.objects.get(url=data['section_url'])
services = section.rel_services_for_section.filter(enable=True).order_by('order')
from .funcs import get_sections
# one_list_childs = { # one_list_childs = {
# 'name' : 'вгд' # 'name' : 'вгд'
@@ -54,11 +52,13 @@ def get_content_for_section_ajax(request):
# #
Dict = { Dict = {
'cur_section': section, 'cur_section': section,
'sections': get_sections(), # 'sections': get_sections(),
'services': services, # 'services': services,
} }
from .funcs import get_section_views_Dict
Dict.update(get_section_views_Dict(section))
html = render_to_string('pages/content/c_blocks_constructor.html', Dict, request=request) html = render_to_string('pages/content/c_blocks_constructor.html', Dict, request=request)
res_Dict = { res_Dict = {

View File

@@ -15,20 +15,16 @@ def section_view(request, url):
# from ArticlesApp.models import ArticleModel # from ArticlesApp.models import ArticleModel
# arts = ArticleModel.objects.filter(enable=True).order_by('-createDT')[:4] # arts = ArticleModel.objects.filter(enable=True).order_by('-createDT')[:4]
services = section.rel_services_for_section.filter(enable=True).order_by('order')
services_view_scheme = '2_cols_wo_group'
for service in services:
if service.rel_children_for_service.filter(enable=True):
services_view_scheme = '3_cols_w_group'
break
Dict = { Dict = {
'page': section, 'page': section,
'services': services,
'services_view_scheme': services_view_scheme
# 'articles': arts, # 'articles': arts,
} }
from .funcs import get_section_views_Dict
Dict.update(get_section_views_Dict(section))
# breadcrumbs_Dict = { # breadcrumbs_Dict = {
# } # }
# Dict.update({'breadcrumbs': breadcrumbs_Dict}) # Dict.update({'breadcrumbs': breadcrumbs_Dict})