0.0.30 3th section main_block_w_subblocks
This commit is contained in:
@@ -33,6 +33,19 @@ class Manager_Enabled(models.Manager):
|
|||||||
self).get_queryset().filter(enable=True)
|
self).get_queryset().filter(enable=True)
|
||||||
|
|
||||||
|
|
||||||
|
def get_unique_url_for_new_instance(instance, sender):
|
||||||
|
url = instance.url
|
||||||
|
if not instance.pk:
|
||||||
|
if not instance.url:
|
||||||
|
name = sender.objects.model.__name__
|
||||||
|
else:
|
||||||
|
name = instance.url
|
||||||
|
from BaseModels.inter import get_unique_url
|
||||||
|
url = get_unique_url(sender, name)
|
||||||
|
|
||||||
|
return url
|
||||||
|
|
||||||
|
|
||||||
class BaseModel(models.Model):
|
class BaseModel(models.Model):
|
||||||
|
|
||||||
name = models.TextField(verbose_name=_('Название'),
|
name = models.TextField(verbose_name=_('Название'),
|
||||||
@@ -150,6 +163,14 @@ class BaseModelViewPage(BaseModel):
|
|||||||
|
|
||||||
# @receiver(pre_save, sender=User)
|
# @receiver(pre_save, sender=User)
|
||||||
def preSaveBaseModelViewPage(sender, instance, **kwargs):
|
def preSaveBaseModelViewPage(sender, instance, **kwargs):
|
||||||
|
if instance:
|
||||||
|
if not instance.url:
|
||||||
|
name = 'section'
|
||||||
|
else:
|
||||||
|
name = instance.url
|
||||||
|
from BaseModels.inter import get_unique_url
|
||||||
|
instance.url = get_unique_url(sender, name)
|
||||||
|
|
||||||
if not sender.url:
|
if not sender.url:
|
||||||
sender.url = slugify(sender.name)
|
sender.url = slugify(sender.name)
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ def get_fieldsNames_of_model(model):
|
|||||||
return fields_names
|
return fields_names
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def get_unique_url(model, name, url=None):
|
def get_unique_url(model, name, url=None):
|
||||||
from .functions import url_translit
|
from .functions import url_translit
|
||||||
|
|
||||||
|
|||||||
@@ -119,10 +119,27 @@ class Admin_StaticPage(SuperModelAdmin, Admin_Trans_BaseModelViewPage):
|
|||||||
admin.site.register(StaticPage,Admin_StaticPage)
|
admin.site.register(StaticPage,Admin_StaticPage)
|
||||||
|
|
||||||
class Admin_Block(Admin_Trans_BaseModelViewPage):
|
class Admin_Block(Admin_Trans_BaseModelViewPage):
|
||||||
|
fieldsets = [
|
||||||
|
(None, {
|
||||||
|
'classes': [],
|
||||||
|
'fields': [
|
||||||
|
('block_type',
|
||||||
|
# 'title',
|
||||||
|
'name', 'description', 'picture'),
|
||||||
|
('bg_color', 'bg_image'),
|
||||||
|
('but_title', 'but_color', 'but_icon'),
|
||||||
|
('url',),
|
||||||
|
('child_in_row_count', 'order'),
|
||||||
|
]
|
||||||
|
})
|
||||||
|
]
|
||||||
|
|
||||||
|
inlines = [Admin_Inline_WidgetForBlock]
|
||||||
|
|
||||||
|
list_display = ['name', 'block_type', 'enable', 'content_type', 'object_id']
|
||||||
inlines = [Admin_StackedInline_Block]
|
list_editable = ['enable']
|
||||||
|
search_fields = ['name']
|
||||||
|
list_filter = ['block_type', 'enable', 'content_type']
|
||||||
|
|
||||||
def has_delete_permission(self, request, obj=None):
|
def has_delete_permission(self, request, obj=None):
|
||||||
if request.user.is_superuser:
|
if request.user.is_superuser:
|
||||||
@@ -131,7 +148,7 @@ class Admin_Block(Admin_Trans_BaseModelViewPage):
|
|||||||
if obj.name in ('About US', 'machines', 'works'):
|
if obj.name in ('About US', 'machines', 'works'):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
admin.site.register(Block,Admin_Block)
|
admin.site.register(Block, Admin_Block)
|
||||||
|
|
||||||
class Admin_Option(Admin_Trans_BaseModel):
|
class Admin_Option(Admin_Trans_BaseModel):
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
from django.db import models
|
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 django.utils.translation import gettext_lazy as _
|
||||||
# from ckeditor.fields import RichTextField
|
# from ckeditor.fields import RichTextField
|
||||||
from ckeditor_uploader.fields import RichTextUploadingField
|
from ckeditor_uploader.fields import RichTextUploadingField
|
||||||
@@ -16,9 +16,14 @@ class StaticPage(BaseModelViewPage):
|
|||||||
verbose_name = _('Статическая страница')
|
verbose_name = _('Статическая страница')
|
||||||
verbose_name_plural = _('Статические страницы')
|
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 = (
|
block_type_choices = (
|
||||||
('photo_n_text', _('Фото с одной стороны + Текст с другой стороны')),
|
('photo_n_text', _('Фото с одной стороны + Текст с другой стороны')),
|
||||||
|
('main_block_w_subblocks', _('Блок с подблоками')),
|
||||||
('present_technology_block', _('описание и НАЗВАНИЕ слева + Картинка справа')),
|
('present_technology_block', _('описание и НАЗВАНИЕ слева + Картинка справа')),
|
||||||
('photo150_n_title', _('Фото 150x150 сверху + заголовок под фото')),
|
('photo150_n_title', _('Фото 150x150 сверху + заголовок под фото')),
|
||||||
('how_work', _('Как с нами работать')),
|
('how_work', _('Как с нами работать')),
|
||||||
@@ -65,12 +70,18 @@ class Block(Block_Abstract):
|
|||||||
child_in_row_count = models.PositiveSmallIntegerField(
|
child_in_row_count = models.PositiveSmallIntegerField(
|
||||||
verbose_name=_('Количество дочерних элементов в строке'), default=3)
|
verbose_name=_('Количество дочерних элементов в строке'), default=3)
|
||||||
|
|
||||||
|
|
||||||
|
def get_widgets(self):
|
||||||
|
return self.rel_widgets_for_block.filter(enable=True).order_by('order')
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
verbose_name = _('Блок на странице')
|
verbose_name = _('Блок на странице')
|
||||||
verbose_name_plural = _('Блоки на странице')
|
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')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
0
PortfolioApp/__init__.py
Normal file
0
PortfolioApp/__init__.py
Normal file
3
PortfolioApp/admin.py
Normal file
3
PortfolioApp/admin.py
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
from django.contrib import admin
|
||||||
|
|
||||||
|
# Register your models here.
|
||||||
6
PortfolioApp/apps.py
Normal file
6
PortfolioApp/apps.py
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
|
class PortfolioappConfig(AppConfig):
|
||||||
|
default_auto_field = 'django.db.models.BigAutoField'
|
||||||
|
name = 'PortfolioApp'
|
||||||
0
PortfolioApp/migrations/__init__.py
Normal file
0
PortfolioApp/migrations/__init__.py
Normal file
18
PortfolioApp/models.py
Normal file
18
PortfolioApp/models.py
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
from django.db import models
|
||||||
|
from BaseModels.base_models import BaseModelViewPage, BaseModel, validate_file_extension
|
||||||
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
# from ckeditor.fields import RichTextField
|
||||||
|
from ckeditor_uploader.fields import RichTextUploadingField
|
||||||
|
# from colorfield.fields import ColorField
|
||||||
|
from django.contrib.contenttypes.models import ContentType
|
||||||
|
from django.contrib.contenttypes.fields import GenericForeignKey
|
||||||
|
from django.contrib.contenttypes.fields import GenericRelation
|
||||||
|
from colorfield.fields import ColorField
|
||||||
|
|
||||||
|
class Project(BaseModelViewPage):
|
||||||
|
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
verbose_name = _('Проект')
|
||||||
|
verbose_name_plural = _('Проекты')
|
||||||
|
|
||||||
3
PortfolioApp/tests.py
Normal file
3
PortfolioApp/tests.py
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
from django.test import TestCase
|
||||||
|
|
||||||
|
# Create your tests here.
|
||||||
3
PortfolioApp/views.py
Normal file
3
PortfolioApp/views.py
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
from django.shortcuts import render
|
||||||
|
|
||||||
|
# Create your views here.
|
||||||
@@ -38,6 +38,11 @@ class BlockPluginPresentation(Block_Abstract):
|
|||||||
verbose_name_plural = _('Блок презентации плагина')
|
verbose_name_plural = _('Блок презентации плагина')
|
||||||
|
|
||||||
|
|
||||||
|
def preSave_BlockPluginPresentation(sender, instance, **kwargs):
|
||||||
|
instance.url = get_unique_url_for_new_instance(instance, sender)
|
||||||
|
pre_save.connect(preSave_BlockPluginPresentation, sender=BlockPluginPresentation, dispatch_uid='pre_save_connect')
|
||||||
|
|
||||||
|
|
||||||
class Section(BaseModelViewPage):
|
class Section(BaseModelViewPage):
|
||||||
|
|
||||||
plugin_presentation = GenericRelation('ServicesApp.BlockPluginPresentation',
|
plugin_presentation = GenericRelation('ServicesApp.BlockPluginPresentation',
|
||||||
@@ -49,6 +54,11 @@ class Section(BaseModelViewPage):
|
|||||||
verbose_name_plural = _('Разделы сайта')
|
verbose_name_plural = _('Разделы сайта')
|
||||||
|
|
||||||
|
|
||||||
|
def preSave_Section(sender, instance, **kwargs):
|
||||||
|
instance.url = get_unique_url_for_new_instance(instance, sender)
|
||||||
|
pre_save.connect(preSave_Section, sender=Section, dispatch_uid='pre_save_connect')
|
||||||
|
|
||||||
|
|
||||||
class Service(BaseModelViewPage):
|
class Service(BaseModelViewPage):
|
||||||
|
|
||||||
url = models.TextField(verbose_name=_('URL привязанной страницы'), null=True, blank=True)
|
url = models.TextField(verbose_name=_('URL привязанной страницы'), null=True, blank=True)
|
||||||
@@ -69,3 +79,7 @@ class Service(BaseModelViewPage):
|
|||||||
class Meta:
|
class Meta:
|
||||||
verbose_name = _('Услуга')
|
verbose_name = _('Услуга')
|
||||||
verbose_name_plural = _('Услуги')
|
verbose_name_plural = _('Услуги')
|
||||||
|
|
||||||
|
def preSave_Service(sender, instance, **kwargs):
|
||||||
|
instance.url = get_unique_url_for_new_instance(instance, sender)
|
||||||
|
pre_save.connect(preSave_Service, sender=Service, dispatch_uid='pre_save_connect')
|
||||||
@@ -4,36 +4,45 @@
|
|||||||
<div class="content_block_functional_features">
|
<div class="content_block_functional_features">
|
||||||
<div class="first_line_block_functional_features">
|
<div class="first_line_block_functional_features">
|
||||||
<div class="container_image_block_functional_features">
|
<div class="container_image_block_functional_features">
|
||||||
<img class="image_functional_features" src="{% static "images/delete_later/image_functional_features.jpg" %}">
|
{# <img class="image_functional_features" src="{% static "images/delete_later/image_functional_features.jpg" %}">#}
|
||||||
|
{% if block.picture %}
|
||||||
|
<img class="image_functional_features" src="{{ MEDIA_URL }}{{ block.picture }}">
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div class="container_txt_first_line_block_functional_features">
|
<div class="container_txt_first_line_block_functional_features">
|
||||||
<div class="title_block_functional_features">
|
{% if block.name %}
|
||||||
Функциональные возможности
|
<div class="title_block_functional_features">
|
||||||
</div>
|
{{ block.name }}
|
||||||
<div class="options_functional_features">
|
|
||||||
<div class="functional_features_option_txt semi_large_light">
|
|
||||||
Плагин 3D Security Designer автоматизирует ряд рутинных процессов.
|
|
||||||
</div>
|
</div>
|
||||||
<div class="functional_features_option_txt semi_large_light">
|
{% endif %}
|
||||||
Значительно сокращает время проектирования в среде Autodesk Revit
|
{% if block.description %}
|
||||||
|
<div class="options_functional_features">
|
||||||
|
<div class="functional_features_option_txt semi_large_light">
|
||||||
|
{{ block.description|safe|linebreaksbr }}
|
||||||
|
</div>
|
||||||
|
{# <div class="functional_features_option_txt semi_large_light">#}
|
||||||
|
{# Значительно сокращает время проектирования в среде Autodesk Revit#}
|
||||||
|
{# </div>#}
|
||||||
|
{# <div class="functional_features_option_txt semi_large_light">#}
|
||||||
|
{# Значительно сокращает время проектирования в среде Autodesk Revit#}
|
||||||
|
{# </div>#}
|
||||||
</div>
|
</div>
|
||||||
<div class="functional_features_option_txt semi_large_light">
|
{% endif %}
|
||||||
Значительно сокращает время проектирования в среде Autodesk Revit
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="container_content_functional_features_block_items">
|
<div class="container_content_functional_features_block_items">
|
||||||
{% include 'widgets/w_functuional_features_item.html' %}
|
{% for widget in block.get_widgets %}
|
||||||
{% include 'widgets/w_functuional_features_item.html' %}
|
{% include 'widgets/w_functuional_features_item.html' %}
|
||||||
{% include 'widgets/w_functuional_features_item.html' %}
|
{% endfor %}
|
||||||
{% include 'widgets/w_functuional_features_item.html' %}
|
{# {% include 'widgets/w_functuional_features_item.html' %}#}
|
||||||
{% include 'widgets/w_functuional_features_item.html' %}
|
{# {% include 'widgets/w_functuional_features_item.html' %}#}
|
||||||
{% include 'widgets/w_functuional_features_item.html' %}
|
{# {% include 'widgets/w_functuional_features_item.html' %}#}
|
||||||
{% include 'widgets/w_functuional_features_item.html' %}
|
{# {% include 'widgets/w_functuional_features_item.html' %}#}
|
||||||
{% include 'widgets/w_functuional_features_item.html' %}
|
{# {% include 'widgets/w_functuional_features_item.html' %}#}
|
||||||
{% include 'widgets/w_functuional_features_item.html' %}
|
{# {% include 'widgets/w_functuional_features_item.html' %}#}
|
||||||
{% include 'widgets/w_functuional_features_item.html' %}
|
{# {% include 'widgets/w_functuional_features_item.html' %}#}
|
||||||
|
{# {% include 'widgets/w_functuional_features_item.html' %}#}
|
||||||
|
{# {% include 'widgets/w_functuional_features_item.html' %}#}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -5,6 +5,10 @@
|
|||||||
{# {% include 'blocks/b_service_2_col.html' %}#}
|
{# {% include 'blocks/b_service_2_col.html' %}#}
|
||||||
{#{% endif %}#}
|
{#{% 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' %}#}
|
{#{% include 'blocks/b_how_with_us_working.html' %}#}
|
||||||
{% for block in page.get_blocks %}
|
{% for block in page.get_blocks %}
|
||||||
@@ -18,9 +22,12 @@
|
|||||||
{% include 'blocks/b_how_dev.html' %}
|
{% include 'blocks/b_how_dev.html' %}
|
||||||
{% elif block.block_type == 'present_technology_block' %}
|
{% elif block.block_type == 'present_technology_block' %}
|
||||||
{% include 'blocks/b_present_technology.html' %}
|
{% include 'blocks/b_present_technology.html' %}
|
||||||
|
{% elif block.block_type == 'main_block_w_subblocks' %}
|
||||||
|
{% include 'blocks/b_functional_features.html' %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% if page.plugin_presentation.all %}
|
|
||||||
|
{% 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 %}
|
{% include 'blocks/b_3d_s_d.html' with block=page.plugin_presentation.all.0 %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% include 'blocks/b_functional_features.html' %}
|
|
||||||
|
|||||||
@@ -1,14 +1,20 @@
|
|||||||
{% load static %}
|
{% load static %}
|
||||||
<div class="container_content_features_block_item bottom">
|
<div class="container_content_features_block_item bottom">
|
||||||
<div class="img_item_container_functional_features">
|
{% if widget.picture %}
|
||||||
<img class="img_item_functional_features" src="{% static "/images/delete_later/image_for_test_functional_features_item.png" %}">
|
<div class="img_item_container_functional_features">
|
||||||
</div>
|
<img class="img_item_functional_features" src="{{ MEDIA_URL }}{{ widget.picture }}">
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
<div class="txt_container_item_features">
|
<div class="txt_container_item_features">
|
||||||
<div class="title_item_features_container">
|
{% if widget.name %}
|
||||||
Автоматическая вставка
|
<div class="title_item_features_container">
|
||||||
</div>
|
{{ widget.name }}
|
||||||
<div class="description_item_features_container standart_txt">
|
</div>
|
||||||
ускоряет расстановку пожарных извещателей более, чем в 10 раз
|
{% endif %}
|
||||||
</div>
|
{% if widget.description %}
|
||||||
|
<div class="description_item_features_container standart_txt">
|
||||||
|
{{ widget.description|safe|linebreaksbr }}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
Reference in New Issue
Block a user