0.0.31 page schemes

This commit is contained in:
SDE
2023-12-06 12:58:04 +03:00
parent 5937d9e380
commit 183000c979
12 changed files with 104 additions and 39 deletions

View File

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

View File

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

View File

@@ -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='Схема страницы'),
),
]

View File

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