From e0a8c6fa000526a94bd36c53b9d52ac6049d391a Mon Sep 17 00:00:00 2001 From: SDE Date: Thu, 7 Dec 2023 22:46:04 +0300 Subject: [PATCH] 0.0.39 fix admin, change slider view --- GeneralApp/admin.py | 3 +++ ServicesApp/admin.py | 14 +++++++------- sets/admin.py | 2 +- templates/blocks/b_slider.html | 14 ++++++++++++-- 4 files changed, 23 insertions(+), 10 deletions(-) diff --git a/GeneralApp/admin.py b/GeneralApp/admin.py index d476d73..5e26824 100644 --- a/GeneralApp/admin.py +++ b/GeneralApp/admin.py @@ -184,6 +184,9 @@ class Admin_Block(Admin_Trans_BaseModelViewPage): if obj.name in ('About US', 'machines', 'works'): return False + def has_add_permission(self, request): + return False + admin.site.register(Block, Admin_Block) class Admin_Option(Admin_Trans_BaseModel): diff --git a/ServicesApp/admin.py b/ServicesApp/admin.py index 884ac34..eb49461 100644 --- a/ServicesApp/admin.py +++ b/ServicesApp/admin.py @@ -8,12 +8,12 @@ from GeneralApp.admin import Admin_StackedInline_Block from SlidesApp.admin import Admin_StackedInline_Slide from django.utils.translation import gettext as _ -def sets_for_formfield_for_dbfield(field, db_field): - if db_field.name == 'url' or db_field.name == 'name' or db_field.name == 'title' or db_field.name == 'name_plural': - field.widget = widgets.TextInput(attrs={'style': 'width: 30%; height: 20px;'}) - if db_field.name == 'description': - field.widget = widgets.Textarea(attrs={'style': 'width: 30%; height: 100px;'}) - return field +# def sets_for_formfield_for_dbfield(field, db_field): +# if db_field.name == 'url' or db_field.name == 'name' or db_field.name == 'title' or db_field.name == 'name_plural': +# field.widget = widgets.TextInput(attrs={'style': 'width: 30%; height: 20px;'}) +# if db_field.name == 'description': +# field.widget = widgets.Textarea(attrs={'style': 'width: 30%; height: 100px;'}) +# return field @@ -78,7 +78,7 @@ class Admin_Section(SuperModelAdmin, Admin_Trans_BaseModelViewPage): 'id', 'name', 'url', # 'title', - 'order', 'modifiedDT', 'createDT' + 'order' ] prepopulated_fields = {"url": ("name_en",)} diff --git a/sets/admin.py b/sets/admin.py index 2fec77d..71da2c6 100644 --- a/sets/admin.py +++ b/sets/admin.py @@ -12,7 +12,7 @@ from django.forms import widgets def sets_for_formfield_for_dbfield(field, db_field): - if db_field.name in ['url', 'name', 'title', 'name_plural']: + if db_field.name in ['url', 'name', 'title', 'name_plural', 'but1_url', 'but2_url']: field.widget = widgets.TextInput(attrs={'style': 'width: 30%; height: 20px;'}) if db_field.name in ['description', 'text', 'video_url', 'bg_video_url']: field.widget = widgets.Textarea(attrs={'style': 'width: 30%; height: 100px;'}) diff --git a/templates/blocks/b_slider.html b/templates/blocks/b_slider.html index 783dd7b..2f28439 100644 --- a/templates/blocks/b_slider.html +++ b/templates/blocks/b_slider.html @@ -3,8 +3,10 @@
{% for slide in page.get_slides %}
-
- {{ slide.name }} +
+ {% if slide.picture %} + {{ slide.name }} + {% endif %}
{% if slide.name or slide.description %}
@@ -22,6 +24,14 @@ {% if slide.description %}
{{ slide.description|linebreaksbr }}
{% endif %} + {% if slide.but_title %} + + {% if slide.but_icon %} + {{ slide.but_title }} + {% endif %} +
{{ slide.but_title }}
+
+ {% endif %}
{% endif %}