0.0.31 page schemes
This commit is contained in:
@@ -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',
|
||||
|
||||
@@ -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(),
|
||||
|
||||
18
ServicesApp/migrations/0007_section_page_scheme.py
Normal file
18
ServicesApp/migrations/0007_section_page_scheme.py
Normal 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='Схема страницы'),
|
||||
),
|
||||
]
|
||||
@@ -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')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user