0.0.18 bg_color for block

This commit is contained in:
SDE
2023-11-28 13:44:52 +03:00
parent 70f204b396
commit f0a45ee53f
10 changed files with 95 additions and 8 deletions

View File

@@ -48,7 +48,7 @@ class Admin_StackedInline_Block(Admin_Trans_GenericBaseIconStackedInline, SuperI
'classes': [],
'fields': [
('block_type', 'title', 'description', 'picture'),
('bg_color', ),
('bg_color', 'bg_image'),
('but_title', 'but_color', 'but_icon'),
('url',),
('child_in_row_count', 'order'),

View File

@@ -0,0 +1,24 @@
# Generated by Django 4.2.7 on 2023-11-28 13:29
import BaseModels.base_models
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('GeneralApp', '0010_block_but_icon_widgetforblock_but_icon_and_more'),
]
operations = [
migrations.AddField(
model_name='block',
name='bg_image',
field=models.FileField(blank=True, null=True, upload_to='uploads/', validators=[BaseModels.base_models.validate_file_extension], verbose_name='Фоновое изображение блока'),
),
migrations.AlterField(
model_name='block',
name='block_type',
field=models.CharField(choices=[('photo_n_text', 'Фото + текст'), ('photo150_n_title', 'Фото 150x150 + заголовок'), ('how_work', 'Как с нами работать'), ('feedback_form', 'Форма обратной связи')], default='photo_n_text', max_length=100, verbose_name='Тип блока'),
),
]

View File

@@ -0,0 +1,19 @@
# Generated by Django 4.2.7 on 2023-11-28 13:32
import colorfield.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('GeneralApp', '0011_block_bg_image_alter_block_block_type'),
]
operations = [
migrations.AlterField(
model_name='block',
name='bg_color',
field=colorfield.fields.ColorField(blank=True, default=None, image_field=None, max_length=25, null=True, samples=None, verbose_name='Цвет фона'),
),
]

View File

@@ -0,0 +1,19 @@
# Generated by Django 4.2.7 on 2023-11-28 13:37
import colorfield.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('GeneralApp', '0012_alter_block_bg_color'),
]
operations = [
migrations.AlterField(
model_name='widgetforblock',
name='bg_color',
field=colorfield.fields.ColorField(blank=True, default=None, image_field=None, max_length=25, null=True, samples=None, verbose_name='Цвет фона'),
),
]

View File

@@ -45,7 +45,11 @@ class Block(Block_Abstract):
url = models.TextField(verbose_name=_('URL привязанной страницы'), null=True, blank=True)
bg_color = ColorField(verbose_name=_('Цвет фона'), default='#FFFFFF')
bg_color = ColorField(verbose_name=_('Цвет фона'), default=None, null=True, blank=True)
bg_image = models.FileField(
upload_to='uploads/', verbose_name=_('Фоновое изображение блока'), null=True, blank=True,
validators=[validate_file_extension]
)
but_title = models.CharField(max_length=100, verbose_name=_('Текст на кнопке'), null=True, blank=True)
but_color = ColorField(verbose_name=_('Цвет кнопки'), default='#000000')
@@ -85,7 +89,7 @@ class WidgetForBlock(BaseModel):
url = models.TextField(verbose_name=_('URL привязанной страницы'), null=True, blank=True)
bg_color = ColorField(verbose_name=_('Цвет фона'), default='#FFFFFF')
bg_color = ColorField(verbose_name=_('Цвет фона'), default=None, null=True, blank=True)
but_title = models.CharField(max_length=100, verbose_name=_('Текст на кнопке'), null=True, blank=True)
but_color = ColorField(verbose_name=_('Цвет кнопки'), default='#000000')

View File

@@ -10,14 +10,16 @@ from GeneralApp.funcs import get_inter_http_respose
def section_view(request, url):
try:
page = Section.objects.get(url=url)
section = Section.objects.get(url=url)
# from ArticlesApp.models import ArticleModel
# arts = ArticleModel.objects.filter(enable=True).order_by('-createDT')[:4]
services = section.rel_services_for_section.filter(enable=True).order_by('order')
Dict = {
'page': page,
'page': section,
'services': services,
# 'articles': arts,
}

View File

@@ -0,0 +1,19 @@
# Generated by Django 4.2.7 on 2023-11-28 13:39
import colorfield.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('SlidesApp', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='slide',
name='bg_color',
field=colorfield.fields.ColorField(blank=True, default=None, image_field=None, max_length=25, null=True, samples=None, verbose_name='Цвет фона'),
),
]

View File

@@ -21,7 +21,7 @@ class Slide(BaseModel):
picture = models.ImageField(
upload_to='uploads/', verbose_name=_('Фоновое изображение'), null=True, blank=True)
bg_color = ColorField(verbose_name=_('Цвет фона'), default='#FFFFFF')
bg_color = ColorField(verbose_name=_('Цвет фона'), default=None, null=True, blank=True)
but_title = models.CharField(max_length=100, verbose_name=_('Текст на кнопке'), null=True, blank=True)
but_color = ColorField(verbose_name=_('Цвет кнопки'), default='#000000')

View File

@@ -1 +1 @@
{% load static %}
style="width: 100%;{% if block.bg_image %} background: {{ block.bg_color }}{% endif %}"

View File

@@ -1,6 +1,6 @@
{% load static %}
{% load i18n %}
<div style="width: 100%;{% if block.bg_color %} background: {{ block.bg_color }}{% endif %}">
<div >
<div class="cut-width">
<div class="form_consultation_container" >
<div class="top_border_gradient"></div>