feat: добавлены модели AboutPage и FooterSettings с админ-панелью и интеграцией скриптов
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
from django.contrib import admin
|
||||
from .models import Service, Project, Client, Order, Review, BlogPost, Category, ServiceRequest
|
||||
from .models import (
|
||||
Service, Project, Client, Order, Review, BlogPost,
|
||||
Category, ServiceRequest, AboutPage, FooterSettings
|
||||
)
|
||||
from .forms import ProjectForm
|
||||
|
||||
@admin.register(Service)
|
||||
@@ -45,4 +48,105 @@ class CategoryAdmin(admin.ModelAdmin):
|
||||
class ServiceRequestAdmin(admin.ModelAdmin):
|
||||
list_display = ('service','token', 'client', 'created_at')
|
||||
search_fields = ('service','token', 'client')
|
||||
list_filter = ('service','token','client')
|
||||
list_filter = ('service','token','client')
|
||||
|
||||
@admin.register(AboutPage)
|
||||
class AboutPageAdmin(admin.ModelAdmin):
|
||||
list_display = ('hero_title', 'is_active', 'updated_at')
|
||||
list_filter = ('is_active', 'updated_at')
|
||||
search_fields = ('hero_title', 'mission_title', 'vision_title')
|
||||
|
||||
fieldsets = (
|
||||
('Hero секция', {
|
||||
'fields': ('hero_badge', 'hero_title', 'hero_description')
|
||||
}),
|
||||
('Статистика', {
|
||||
'fields': ('stat_projects', 'stat_clients', 'stat_years', 'stat_support')
|
||||
}),
|
||||
('Миссия', {
|
||||
'fields': (
|
||||
'mission_badge', 'mission_title', 'mission_description',
|
||||
'mission_point_1_title', 'mission_point_1_text',
|
||||
'mission_point_2_title', 'mission_point_2_text',
|
||||
'mission_point_3_title', 'mission_point_3_text',
|
||||
)
|
||||
}),
|
||||
('Видение', {
|
||||
'fields': ('vision_badge', 'vision_title', 'vision_description')
|
||||
}),
|
||||
('Навыки', {
|
||||
'fields': (
|
||||
'skill_1_name', 'skill_1_percent',
|
||||
'skill_2_name', 'skill_2_percent',
|
||||
'skill_3_name', 'skill_3_percent',
|
||||
'skill_4_name', 'skill_4_percent',
|
||||
)
|
||||
}),
|
||||
('Команда', {
|
||||
'fields': ('team_badge', 'team_title', 'team_description')
|
||||
}),
|
||||
('Ценности', {
|
||||
'fields': (
|
||||
'values_badge', 'values_title',
|
||||
'value_1_icon', 'value_1_title', 'value_1_text',
|
||||
'value_2_icon', 'value_2_title', 'value_2_text',
|
||||
'value_3_icon', 'value_3_title', 'value_3_text',
|
||||
'value_4_icon', 'value_4_title', 'value_4_text',
|
||||
)
|
||||
}),
|
||||
('Контакты', {
|
||||
'fields': ('contact_title', 'contact_description')
|
||||
}),
|
||||
('Настройки', {
|
||||
'fields': ('is_active',)
|
||||
}),
|
||||
)
|
||||
|
||||
def has_add_permission(self, request):
|
||||
return not AboutPage.objects.filter(is_active=True).exists()
|
||||
|
||||
|
||||
@admin.register(FooterSettings)
|
||||
class FooterSettingsAdmin(admin.ModelAdmin):
|
||||
list_display = ('company_name', 'email', 'is_active', 'updated_at')
|
||||
list_filter = ('is_active', 'updated_at')
|
||||
search_fields = ('company_name', 'email')
|
||||
|
||||
fieldsets = (
|
||||
('Информация о компании', {
|
||||
'fields': ('company_name', 'company_description', 'company_logo_icon')
|
||||
}),
|
||||
('Социальные сети', {
|
||||
'fields': ('telegram_url', 'instagram_url', 'linkedin_url', 'github_url', 'facebook_url', 'twitter_url'),
|
||||
'classes': ('collapse',)
|
||||
}),
|
||||
('Контактная информация', {
|
||||
'fields': ('email', 'phone', 'address')
|
||||
}),
|
||||
('Меню футера', {
|
||||
'fields': (
|
||||
'show_services_menu', 'services_title',
|
||||
'show_company_menu', 'company_menu_title'
|
||||
),
|
||||
'classes': ('collapse',)
|
||||
}),
|
||||
('Copyright', {
|
||||
'fields': ('copyright_text',)
|
||||
}),
|
||||
('Интеграция скриптов', {
|
||||
'fields': ('google_analytics', 'google_adsense', 'yandex_metrika', 'facebook_pixel'),
|
||||
'description': 'Вставьте коды аналитики без тегов <script></script>',
|
||||
'classes': ('collapse',)
|
||||
}),
|
||||
('Дополнительные скрипты', {
|
||||
'fields': ('custom_head_scripts', 'custom_body_scripts'),
|
||||
'description': 'Вставьте дополнительные скрипты С тегами <script></script>',
|
||||
'classes': ('collapse',)
|
||||
}),
|
||||
('Настройки', {
|
||||
'fields': ('is_active',)
|
||||
}),
|
||||
)
|
||||
|
||||
def has_add_permission(self, request):
|
||||
return not FooterSettings.objects.filter(is_active=True).exists()
|
||||
|
||||
Reference in New Issue
Block a user