0.0.39 fix admin, change slider view

This commit is contained in:
SDE
2023-12-07 22:46:04 +03:00
parent ed019758d5
commit e0a8c6fa00
4 changed files with 23 additions and 10 deletions

View File

@@ -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):

View File

@@ -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",)}

View File

@@ -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;'})

View File

@@ -3,8 +3,10 @@
<div class="container_sliders">
{% for slide in page.get_slides %}
<div class="one_slide_container{% if forloop.counter0 == 0 %} show{% else %} hide{% endif %}" data-id-slide="{{ forloop.counter }}">
<div class="picture_slider_container">
<img class="picture_slider" src="{{ MEDIA_URL }}{{ slide.picture }}" alt="{{ slide.name }}" />
<div class="picture_slider_container" {% if slide.bg_color %}style="background: {{ slide.bg_color }}" {% endif %}>
{% if slide.picture %}
<img class="picture_slider" src="{{ MEDIA_URL }}{{ slide.picture }}" alt="{{ slide.name }}" />
{% endif %}
</div>
{% if slide.name or slide.description %}
<div class="cut-width slider_block_text_container">
@@ -22,6 +24,14 @@
{% if slide.description %}
<div class="description_slide">{{ slide.description|linebreaksbr }}</div>
{% endif %}
{% if slide.but_title %}
<a href="{{ slide.url }}">
{% if slide.but_icon %}
<img src="{{ MEDIA_URL }}{{ slide.but_icon }}" alt="{{ slide.but_title }}" />
{% endif %}
<div style="border: {{ slide.but_color }} solid 5px; color: {{ slide.but_color }}">{{ slide.but_title }}</div>
</a>
{% endif %}
</div>
</div>
{% endif %}