Add Django backend, 1C integration, deploy config and API docs
Backend (Django 4.2 + DRF): - accounts: phone OTP login, JWT, profile, addresses - catalog: categories, products, images, filters, search, hits/new/related - orders: creation with Idempotency-Key, stock reservation, status history, cancel - loyalty: bonus accounts, promo codes, gift certificates - payments: payment records and YooKassa webhook handling - content: static pages, banners, site settings - integration: 1C exchange (catalog sync, order push via outbox, statuses, bonuses) - common: error envelope, pagination, request-id, integration auth, admin dashboard Infrastructure: Dockerfile, docker-compose (Postgres, Redis, Celery worker/beat, Nginx), requirements split by environment, OpenAPI contracts for site and 1C, architecture doc. Tests: 22 pytest cases covering catalog, orders, idempotency, OTP, integration.
This commit is contained in:
1 parent
5f8d37357d
commit
756f40353b
130 files changed
+10066
No files matched your search
@@ -0,0 +1,62 @@
|
||||
from django.contrib import admin
|
||||
|
||||
from .models import Banner, SiteSettings, StaticPage
|
||||
|
||||
|
||||
@admin.register(SiteSettings)
|
||||
class SiteSettingsAdmin(admin.ModelAdmin):
|
||||
fieldsets = (
|
||||
(
|
||||
"Контакты",
|
||||
{"fields": ("site_name", "phone", "email", "address", "working_hours")},
|
||||
),
|
||||
("Соцсети", {"fields": ("telegram_url", "vk_url", "whatsapp_url")}),
|
||||
(
|
||||
"Доставка",
|
||||
{"fields": ("free_delivery_threshold", "default_delivery_cost")},
|
||||
),
|
||||
(
|
||||
"Лояльность",
|
||||
{
|
||||
"fields": (
|
||||
"bonus_accrual_percent",
|
||||
"bonus_max_payment_percent",
|
||||
"bonus_ttl_days",
|
||||
)
|
||||
},
|
||||
),
|
||||
("Документы", {"fields": ("privacy_policy_url", "offer_url")}),
|
||||
("Служебное", {"fields": ("updated_at",)}),
|
||||
)
|
||||
readonly_fields = ("updated_at",)
|
||||
|
||||
def has_add_permission(self, request):
|
||||
return not SiteSettings.objects.exists()
|
||||
|
||||
def has_delete_permission(self, request, obj=None):
|
||||
return False
|
||||
|
||||
|
||||
@admin.register(StaticPage)
|
||||
class StaticPageAdmin(admin.ModelAdmin):
|
||||
list_display = ("title", "slug", "is_published", "updated_at")
|
||||
list_filter = ("is_published",)
|
||||
search_fields = ("title", "slug", "content")
|
||||
prepopulated_fields = {"slug": ("title",)}
|
||||
readonly_fields = ("created_at", "updated_at")
|
||||
|
||||
|
||||
@admin.register(Banner)
|
||||
class BannerAdmin(admin.ModelAdmin):
|
||||
list_display = (
|
||||
"title",
|
||||
"position",
|
||||
"is_active",
|
||||
"sort_order",
|
||||
"starts_at",
|
||||
"ends_at",
|
||||
)
|
||||
list_filter = ("position", "is_active")
|
||||
search_fields = ("title",)
|
||||
list_editable = ("is_active", "sort_order")
|
||||
readonly_fields = ("created_at", "updated_at")
|
||||
Reference in new issue
Block a user