0.0.32 video links and change font
This commit is contained in:
@@ -27,8 +27,9 @@ class Admin_Inline_WidgetForBlock(SuperInlineModelAdmin, Admin_Trans_BaseIconSta
|
||||
(
|
||||
# 'title',
|
||||
'name', 'description', 'text',
|
||||
'picture'
|
||||
'picture',
|
||||
),
|
||||
'video_url',
|
||||
('bg_color', ),
|
||||
('but_title', 'but_color', 'but_icon'),
|
||||
('url', 'order'),
|
||||
@@ -53,11 +54,17 @@ class Admin_StackedInline_Block(Admin_Trans_GenericBaseIconStackedInline, SuperI
|
||||
'fields': [
|
||||
('block_type',
|
||||
# 'title',
|
||||
'name', 'description', 'picture'),
|
||||
('bg_color', 'bg_image'),
|
||||
'name', 'description'),
|
||||
('picture', ),
|
||||
('video_url',),
|
||||
('bg_color', 'bg_image',),
|
||||
# ('bg_video_url',),
|
||||
('but_title', 'but_color', 'but_icon'),
|
||||
('url',),
|
||||
('child_in_row_count', 'order'),
|
||||
(
|
||||
# 'child_in_row_count',
|
||||
'order',
|
||||
),
|
||||
]
|
||||
})
|
||||
]
|
||||
@@ -125,11 +132,15 @@ class Admin_Block(Admin_Trans_BaseModelViewPage):
|
||||
'fields': [
|
||||
('block_type',
|
||||
# 'title',
|
||||
'name', 'description', 'picture'),
|
||||
('bg_color', 'bg_image'),
|
||||
'name', 'description'),
|
||||
('picture', 'video_url'),
|
||||
('bg_color', 'bg_image', 'bg_video_url'),
|
||||
('but_title', 'but_color', 'but_icon'),
|
||||
('url',),
|
||||
('child_in_row_count', 'order'),
|
||||
(
|
||||
# 'child_in_row_count',
|
||||
'order',
|
||||
),
|
||||
]
|
||||
})
|
||||
]
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
# Generated by Django 4.2.7 on 2023-12-06 13:20
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('GeneralApp', '0016_alter_block_block_type'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='block',
|
||||
name='bg_video_url',
|
||||
field=models.TextField(blank=True, null=True, verbose_name='Ссылка на фоновое видео'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='block',
|
||||
name='video_url',
|
||||
field=models.TextField(blank=True, null=True, verbose_name='Ссылка на видео'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='widgetforblock',
|
||||
name='video_url',
|
||||
field=models.TextField(blank=True, null=True, verbose_name='Ссылка на видео'),
|
||||
),
|
||||
]
|
||||
@@ -53,11 +53,14 @@ class Block(Block_Abstract):
|
||||
|
||||
url = models.TextField(verbose_name=_('URL привязанной страницы'), null=True, blank=True)
|
||||
|
||||
video_url = models.TextField(verbose_name=_('Ссылка на видео'), null=True, blank=True)
|
||||
|
||||
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]
|
||||
)
|
||||
bg_video_url = models.TextField(verbose_name=_('Ссылка на фоновое видео'), null=True, blank=True)
|
||||
|
||||
but_title = models.CharField(max_length=100, verbose_name=_('Текст на кнопке'), null=True, blank=True)
|
||||
but_color = ColorField(verbose_name=_('Цвет кнопки'), default='#000000')
|
||||
@@ -79,9 +82,9 @@ class Block(Block_Abstract):
|
||||
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')
|
||||
# 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')
|
||||
|
||||
|
||||
|
||||
@@ -100,6 +103,8 @@ class WidgetForBlock(BaseModel):
|
||||
picture = models.FileField(upload_to='uploads/', verbose_name=_('Картинка'), null=True, blank=True,
|
||||
validators=[validate_file_extension])
|
||||
|
||||
video_url = models.TextField(verbose_name=_('Ссылка на видео'), null=True, blank=True)
|
||||
|
||||
# block_type = models.CharField(max_length=100, choices=block_type_choices, verbose_name=_('Тип блока'), default='photo_n_text')
|
||||
|
||||
url = models.TextField(verbose_name=_('URL привязанной страницы'), null=True, blank=True)
|
||||
|
||||
@@ -6,6 +6,7 @@ from django.contrib.auth.decorators import login_required
|
||||
from .models import *
|
||||
from django.conf import settings
|
||||
from .funcs import get_inter_http_respose
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
def test_code(request):
|
||||
|
||||
@@ -20,7 +21,13 @@ def MainPage(request):
|
||||
from .init_options import init_options
|
||||
init_options()
|
||||
|
||||
page = StaticPage.objects.get(url='main')
|
||||
try:
|
||||
page = StaticPage.objects.get(url='main')
|
||||
except StaticPage.DoesNotExist:
|
||||
page = StaticPage.objects.create(
|
||||
url='main',
|
||||
name_ru = _('Главная')
|
||||
)
|
||||
|
||||
# from ArticlesApp.models import ArticleModel
|
||||
# arts = ArticleModel.objects.filter(enable=True).order_by('-createDT')[:4]
|
||||
|
||||
Reference in New Issue
Block a user