0.0.30 3th section main_block_w_subblocks
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
from django.db import models
|
||||
from BaseModels.base_models import BaseModelViewPage, BaseModel, validate_file_extension
|
||||
from BaseModels.base_models import *
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
# from ckeditor.fields import RichTextField
|
||||
from ckeditor_uploader.fields import RichTextUploadingField
|
||||
@@ -16,9 +16,14 @@ class StaticPage(BaseModelViewPage):
|
||||
verbose_name = _('Статическая страница')
|
||||
verbose_name_plural = _('Статические страницы')
|
||||
|
||||
def preSave_StaticPage(sender, instance, **kwargs):
|
||||
instance.url = get_unique_url_for_new_instance(instance, sender)
|
||||
pre_save.connect(preSave_StaticPage, sender=StaticPage, dispatch_uid='pre_save_connect')
|
||||
|
||||
|
||||
block_type_choices = (
|
||||
('photo_n_text', _('Фото с одной стороны + Текст с другой стороны')),
|
||||
('main_block_w_subblocks', _('Блок с подблоками')),
|
||||
('present_technology_block', _('описание и НАЗВАНИЕ слева + Картинка справа')),
|
||||
('photo150_n_title', _('Фото 150x150 сверху + заголовок под фото')),
|
||||
('how_work', _('Как с нами работать')),
|
||||
@@ -65,12 +70,18 @@ class Block(Block_Abstract):
|
||||
child_in_row_count = models.PositiveSmallIntegerField(
|
||||
verbose_name=_('Количество дочерних элементов в строке'), default=3)
|
||||
|
||||
|
||||
def get_widgets(self):
|
||||
return self.rel_widgets_for_block.filter(enable=True).order_by('order')
|
||||
|
||||
class Meta:
|
||||
verbose_name = _('Блок на странице')
|
||||
verbose_name_plural = _('Блоки на странице')
|
||||
|
||||
|
||||
|
||||
def preSave_Block(sender, instance, **kwargs):
|
||||
instance.url = get_unique_url_for_new_instance(instance, sender)
|
||||
pre_save.connect(preSave_Block, sender=Block, dispatch_uid='pre_save_connect')
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user