From 183000c979fa0410487f4221d427b6bc71270812 Mon Sep 17 00:00:00 2001 From: SDE Date: Wed, 6 Dec 2023 12:58:04 +0300 Subject: [PATCH] 0.0.31 page schemes --- .../migrations/0016_alter_block_block_type.py | 18 ++++++++ ServicesApp/admin.py | 2 +- ServicesApp/funcs.py | 14 +++--- .../migrations/0007_section_page_scheme.py | 18 ++++++++ ServicesApp/models.py | 10 +++++ ...ol.html => b_services_2_col_wo_group.html} | 0 ...ce.html => b_services_3cols_w_groups.html} | 0 .../pages/content/c_blocks_constructor.html | 12 ++---- .../pages/content/c_section_content.html | 43 ++++++++----------- templates/pages/page_schemes/ps_plugin.html | 8 ++++ .../pages/page_schemes/ps_projecting.html | 9 ++++ templates/pages/page_schemes/ps_services.html | 9 ++++ 12 files changed, 104 insertions(+), 39 deletions(-) create mode 100644 GeneralApp/migrations/0016_alter_block_block_type.py create mode 100644 ServicesApp/migrations/0007_section_page_scheme.py rename templates/blocks/{b_service_2_col.html => b_services_2_col_wo_group.html} (100%) rename templates/blocks/{b_service.html => b_services_3cols_w_groups.html} (100%) create mode 100644 templates/pages/page_schemes/ps_plugin.html create mode 100644 templates/pages/page_schemes/ps_projecting.html create mode 100644 templates/pages/page_schemes/ps_services.html diff --git a/GeneralApp/migrations/0016_alter_block_block_type.py b/GeneralApp/migrations/0016_alter_block_block_type.py new file mode 100644 index 0000000..a2323a5 --- /dev/null +++ b/GeneralApp/migrations/0016_alter_block_block_type.py @@ -0,0 +1,18 @@ +# Generated by Django 4.2.7 on 2023-12-06 12:42 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('GeneralApp', '0015_option_name_en_option_name_ru_option_prefix_en_and_more'), + ] + + operations = [ + migrations.AlterField( + model_name='block', + name='block_type', + field=models.CharField(choices=[('photo_n_text', 'Фото с одной стороны + Текст с другой стороны'), ('main_block_w_subblocks', 'Блок с подблоками'), ('present_technology_block', 'описание и НАЗВАНИЕ слева + Картинка справа'), ('photo150_n_title', 'Фото 150x150 сверху + заголовок под фото'), ('how_work', 'Как с нами работать'), ('how_dev', 'Как ведется разработка'), ('feedback_form', 'Форма обратной связи')], default='photo_n_text', max_length=100, verbose_name='Тип блока'), + ), + ] diff --git a/ServicesApp/admin.py b/ServicesApp/admin.py index fa3a8f0..7848ecb 100644 --- a/ServicesApp/admin.py +++ b/ServicesApp/admin.py @@ -49,7 +49,7 @@ class Admin_Section(SuperModelAdmin, Admin_Trans_BaseModelViewPage): fieldsets = [ (None, { 'classes': ['wide'], - 'fields': ('name', + 'fields': ('name', 'page_scheme', 'url', 'title', 'description', 'text', diff --git a/ServicesApp/funcs.py b/ServicesApp/funcs.py index 019b6e0..87aec1c 100644 --- a/ServicesApp/funcs.py +++ b/ServicesApp/funcs.py @@ -8,11 +8,15 @@ def get_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 + + services_view_scheme = None + if services: + 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(), diff --git a/ServicesApp/migrations/0007_section_page_scheme.py b/ServicesApp/migrations/0007_section_page_scheme.py new file mode 100644 index 0000000..66bc328 --- /dev/null +++ b/ServicesApp/migrations/0007_section_page_scheme.py @@ -0,0 +1,18 @@ +# Generated by Django 4.2.7 on 2023-12-06 12:42 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('ServicesApp', '0006_alter_blockpluginpresentation_options'), + ] + + operations = [ + migrations.AddField( + model_name='section', + name='page_scheme', + field=models.CharField(choices=[('projecting', 'Проектирование'), ('services', 'Разработка'), ('plugin', 'Плагин')], default='projecting', max_length=100, verbose_name='Схема страницы'), + ), + ] diff --git a/ServicesApp/models.py b/ServicesApp/models.py index 091a005..b348fe6 100644 --- a/ServicesApp/models.py +++ b/ServicesApp/models.py @@ -43,8 +43,18 @@ def preSave_BlockPluginPresentation(sender, instance, **kwargs): pre_save.connect(preSave_BlockPluginPresentation, sender=BlockPluginPresentation, dispatch_uid='pre_save_connect') +page_scheme_choices = ( + ('projecting', _('Проектирование')), + ('services', _('Разработка')), + ('plugin', _('Плагин')), +) + + class Section(BaseModelViewPage): + page_scheme = models.CharField( + max_length=100, verbose_name=_('Схема страницы'), choices=page_scheme_choices, default='projecting') + plugin_presentation = GenericRelation('ServicesApp.BlockPluginPresentation', related_query_name='grel_%(class)s_for_block_plugin_presentation') diff --git a/templates/blocks/b_service_2_col.html b/templates/blocks/b_services_2_col_wo_group.html similarity index 100% rename from templates/blocks/b_service_2_col.html rename to templates/blocks/b_services_2_col_wo_group.html diff --git a/templates/blocks/b_service.html b/templates/blocks/b_services_3cols_w_groups.html similarity index 100% rename from templates/blocks/b_service.html rename to templates/blocks/b_services_3cols_w_groups.html diff --git a/templates/pages/content/c_blocks_constructor.html b/templates/pages/content/c_blocks_constructor.html index d95daac..cef6481 100644 --- a/templates/pages/content/c_blocks_constructor.html +++ b/templates/pages/content/c_blocks_constructor.html @@ -1,13 +1,11 @@ {#{% include 'blocks/dynamic/b_sections_buttons.html' %}#} {#{% if services_view_scheme == '3_cols_w_group' %}#} -{# {% include 'blocks/b_service.html' %}#} +{# {% include 'blocks/b_services_3cols_w_groups.html' %}#} {#{% elif services_view_scheme == '2_cols_wo_group' %}#} -{# {% include 'blocks/b_service_2_col.html' %}#} +{# {% include 'blocks/b_services_2_col_wo_group.html' %}#} {#{% endif %}#} -{% if page.url == '3d-security-designer' and page.plugin_presentation.all %} - {% include 'blocks/b_3d_s_d.html' with block=page.plugin_presentation.all.0 %} -{% endif %} + {#{% include 'blocks/b_how_with_us_working.html' %}#} @@ -27,7 +25,5 @@ {% endif %} {% endfor %} -{% if page.url != '3d-security-designer' and page.plugin_presentation.all %} - {% include 'blocks/b_3d_s_d.html' with block=page.plugin_presentation.all.0 %} -{% endif %} + diff --git a/templates/pages/content/c_section_content.html b/templates/pages/content/c_section_content.html index 1ec9ded..6d3dab2 100644 --- a/templates/pages/content/c_section_content.html +++ b/templates/pages/content/c_section_content.html @@ -1,32 +1,25 @@ {% include 'blocks/dynamic/b_sections_buttons.html' %} +
- {% if page.description %} -
{{ page.description }}
- {% endif %} - {% if page.title %} -
{{ page.title }}
+ {% if page.description or page.title %} +
+ {% if page.description %} +
{{ page.description }}
+ {% endif %} + {% if page.title %} +
{{ page.title }}
+ {% endif %} +
{% endif %}
-{% if services_view_scheme == '3_cols_w_group' %} - {% include 'blocks/b_service.html' %} -{% elif services_view_scheme == '2_cols_wo_group' %} - {% include 'blocks/b_service_2_col.html' %} + +{% if page.page_scheme == 'projecting' %} + {% include "pages/page_schemes/ps_projecting.html" %} +{% elif page.page_scheme == 'services' %} + {% include "pages/page_schemes/ps_services.html" %} +{% elif page.page_scheme == 'plugin' %} + {% include "pages/page_schemes/ps_plugin.html" %} {% endif %} -{% include "pages/content/c_blocks_constructor.html" %} -{#{% for block in page.blocks.all %}#} -{# {% if block.block_type == 'photo150_n_title' %}#} -{# {% include 'blocks/b_photo150_n_title.html' %}#} -{# {% elif block.block_type == 'how_work' %}#} -{# {% include 'blocks/b_how_with_us_working.html' %}#} -{# {% elif block.block_type == 'feedback_form' %}#} -{# {% include 'forms/f_consultation.html' %}#} -{# {% elif block.block_type == 'how_dev' %}#} -{# {% include 'blocks/b_how_dev.html' %}#} -{# {% endif %}#} -{##} -{#{% endfor %}#} -{#{% if page.plugin_presentation.all %}#} -{# {% include 'blocks/b_3d_s_d.html' with block=page.plugin_presentation.all.0 %}#} -{#{% endif %}#} \ No newline at end of file + diff --git a/templates/pages/page_schemes/ps_plugin.html b/templates/pages/page_schemes/ps_plugin.html new file mode 100644 index 0000000..91ca18e --- /dev/null +++ b/templates/pages/page_schemes/ps_plugin.html @@ -0,0 +1,8 @@ +{% if page.plugin_presentation.all %} + {% include 'blocks/b_3d_s_d.html' with block=page.plugin_presentation.all.0 %} +{% endif %} + +{% include "pages/content/c_blocks_constructor.html" %} + + +{% include 'blocks/b_services_2_col_wo_group.html' %} diff --git a/templates/pages/page_schemes/ps_projecting.html b/templates/pages/page_schemes/ps_projecting.html new file mode 100644 index 0000000..3578cc6 --- /dev/null +++ b/templates/pages/page_schemes/ps_projecting.html @@ -0,0 +1,9 @@ + +{% include 'blocks/b_services_3cols_w_groups.html' %} + + +{% if page.plugin_presentation.all %} + {% include 'blocks/b_3d_s_d.html' with block=page.plugin_presentation.all.0 %} +{% endif %} + +{% include "pages/content/c_blocks_constructor.html" %} \ No newline at end of file diff --git a/templates/pages/page_schemes/ps_services.html b/templates/pages/page_schemes/ps_services.html new file mode 100644 index 0000000..9e86588 --- /dev/null +++ b/templates/pages/page_schemes/ps_services.html @@ -0,0 +1,9 @@ + +{% include 'blocks/b_services_2_col_wo_group.html' %} + + +{% if page.plugin_presentation.all %} + {% include 'blocks/b_3d_s_d.html' with block=page.plugin_presentation.all.0 %} +{% endif %} + +{% include "pages/content/c_blocks_constructor.html" %} \ No newline at end of file