Some checks failed
continuous-integration/drone/push Build is failing
- 📊 Создана ContactInfo модель с полями компании, контактов и описания - 🎨 Полностью переработана страница about.html с современными карточками - 🔗 Админ-панель для управления контактной информацией - 💎 CSS анимации и градиенты для улучшения UI/UX - 🗄️ Миграция 0012_contactinfo.py для создания таблицы - 🔧 Обновлены views для использования данных из БД
90 lines
3.7 KiB
Python
90 lines
3.7 KiB
Python
from django.contrib import admin
|
|
from .models import Service, Project, Client, Order, Review, BlogPost, Category, ServiceRequest, HeroBanner, ContactInfo
|
|
from .forms import ProjectForm
|
|
|
|
@admin.register(ContactInfo)
|
|
class ContactInfoAdmin(admin.ModelAdmin):
|
|
list_display = ('company_name', 'email', 'phone', 'is_active')
|
|
list_filter = ('is_active',)
|
|
search_fields = ('company_name', 'email', 'phone')
|
|
fields = ('company_name', 'email', 'phone', 'telegram', 'address', 'working_hours',
|
|
'description', 'call_to_action', 'subtitle', 'is_active')
|
|
|
|
@admin.register(HeroBanner)
|
|
class HeroBannerAdmin(admin.ModelAdmin):
|
|
list_display = ('title', 'is_active', 'order', 'created_at')
|
|
list_filter = ('is_active', 'created_at')
|
|
search_fields = ('title', 'subtitle')
|
|
fields = ('title', 'subtitle', 'description', 'image', 'video', 'video_poster',
|
|
'button_text', 'button_link', 'is_active', 'order')
|
|
list_editable = ('is_active', 'order')
|
|
|
|
@admin.register(Service)
|
|
class ServiceAdmin(admin.ModelAdmin):
|
|
list_display = ('name', 'category', 'price', 'has_video')
|
|
search_fields = ('name', 'category')
|
|
fields = ('name', 'description', 'price', 'category', 'image', 'video', 'video_poster')
|
|
|
|
def has_video(self, obj):
|
|
return bool(obj.video)
|
|
has_video.boolean = True
|
|
has_video.short_description = 'Есть видео'
|
|
|
|
@admin.register(Project)
|
|
class ProjectAdmin(admin.ModelAdmin):
|
|
form = ProjectForm
|
|
list_display = ('name', 'client','service', 'status', 'order', 'has_video')
|
|
list_filter = ('name', 'client','service', 'status', 'order')
|
|
search_fields = ('name', 'client','service', 'status', 'order', 'client__first_name', 'client__last_name')
|
|
fields = ('name', 'description', 'completion_date', 'client', 'service', 'order',
|
|
'category', 'image', 'video', 'video_poster', 'status')
|
|
|
|
def has_video(self, obj):
|
|
return bool(obj.video)
|
|
has_video.boolean = True
|
|
has_video.short_description = 'Есть видео'
|
|
|
|
@admin.register(Client)
|
|
class ClientAdmin(admin.ModelAdmin):
|
|
list_display = ('first_name', 'last_name', 'email', 'phone_number')
|
|
search_fields = ('first_name', 'last_name', 'email')
|
|
|
|
@admin.register(Order)
|
|
class OrderAdmin(admin.ModelAdmin):
|
|
list_display = ('id', 'service', 'client', 'client__email', 'client__phone_number', 'status')
|
|
list_filter = ('status','client', 'order_date')
|
|
search_fields = ('client__first_name', 'service__name','status','client', 'order_date')
|
|
|
|
@admin.register(Review)
|
|
class ReviewAdmin(admin.ModelAdmin):
|
|
list_display = ('client', 'service', 'rating', 'review_date', 'has_video')
|
|
list_filter = ('rating',)
|
|
search_fields = ('client__first_name', 'service__name')
|
|
fields = ('client', 'service', 'project', 'rating', 'comment', 'image', 'video', 'video_poster')
|
|
|
|
def has_video(self, obj):
|
|
return bool(obj.video)
|
|
has_video.boolean = True
|
|
has_video.short_description = 'Есть видео'
|
|
|
|
@admin.register(BlogPost)
|
|
class BlogPostAdmin(admin.ModelAdmin):
|
|
list_display = ('title', 'published_date', 'has_video')
|
|
search_fields = ('title',)
|
|
fields = ('title', 'content', 'image', 'video', 'video_poster')
|
|
|
|
def has_video(self, obj):
|
|
return bool(obj.video)
|
|
has_video.boolean = True
|
|
has_video.short_description = 'Есть видео'
|
|
|
|
@admin.register(Category)
|
|
class CategoryAdmin(admin.ModelAdmin):
|
|
list_display = ('name','description')
|
|
search_fields = ('name',)
|
|
|
|
@admin.register(ServiceRequest)
|
|
class ServiceRequestAdmin(admin.ModelAdmin):
|
|
list_display = ('service','token', 'client', 'created_at')
|
|
search_fields = ('service','token', 'client')
|
|
list_filter = ('service','token','client') |