mirror of
https://github.com/ada-dmitry/Project_WEB.git
synced 2026-09-23 23:50:20 +00:00
- Created .gitignore to exclude Python-generated files and virtual environments. - Added .python-version to specify Python version 3.13. - Implemented models for Client, Brigade, Service, Order, and CompletedWork. - Created Django admin configurations for managing models. - Added management command to seed the database with test data. - Created initial migrations for the models. - Developed views and templates for listing and detailing orders, clients, and brigades. - Set up URL routing for the cleaning app. - Configured Django settings and WSGI/ASGI entry points. - Added basic test structure in tests.py. - Included project metadata in pyproject.toml and uv.lock.
37 lines
1.2 KiB
Python
37 lines
1.2 KiB
Python
from django.contrib import admin
|
|
from .models import Client, Brigade, Service, Order, CompletedWork
|
|
|
|
|
|
class CompletedWorkInline(admin.TabularInline):
|
|
model = CompletedWork
|
|
extra = 1
|
|
|
|
@admin.register(Client)
|
|
class ClientAdmin(admin.ModelAdmin):
|
|
list_display = ['full_name', 'phone', 'address', 'preferred_time']
|
|
search_fields = ['full_name', 'phone', 'address']
|
|
list_filter = ['preferred_time']
|
|
|
|
@admin.register(Brigade)
|
|
class BrigadeAdmin(admin.ModelAdmin):
|
|
list_display = ['name', 'supervisor', 'employee_count', 'specialization']
|
|
search_fields = ['name', 'supervisor', 'specialization']
|
|
|
|
|
|
@admin.register(Service)
|
|
class ServiceAdmin(admin.ModelAdmin):
|
|
list_display = ['name', 'price_per_sqm', 'duration_per_sqm']
|
|
search_fields = ['name']
|
|
|
|
@admin.register(Order)
|
|
class OrderAdmin(admin.ModelAdmin):
|
|
list_display = ['id', 'client', 'brigade', 'date', 'start_time', 'end_time']
|
|
search_fields = ['client__full_name', 'brigade__name']
|
|
list_filter = ['date', 'brigade']
|
|
inlines = [CompletedWorkInline]
|
|
|
|
@admin.register(CompletedWork)
|
|
class CompletedWorkAdmin(admin.ModelAdmin):
|
|
list_display = ['order', 'service', 'area']
|
|
search_fields = ['order__client__full_name', 'service__name']
|