Обновили шапку и вывод всехтоваров. Добавили фильтры

This commit is contained in:
2025-10-24 23:11:29 +03:00
parent 2fb6253d06
commit 9ad9f604e9
35 changed files with 2498 additions and 1270 deletions

View File

@@ -42,6 +42,7 @@ INSTALLED_APPS = [
'products',
'inventory',
'orders',
'customers',
]
MIDDLEWARE = [
@@ -185,5 +186,20 @@ DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
DEFAULT_FROM_EMAIL = 'noreply@example.com'
# Настройки телефонных номеров
PHONENUMBER_DEFAULT_REGION = 'BY' # Регион по умолчанию для номеров без кода страны
# Указываем нашу кастомную модель пользователя
AUTH_USER_MODEL = 'accounts.CustomUser'
# ВРЕМЕННЫЙ ФИХ для SQLite: удалить когда база данных будет PostgreSQL
# Регистрируем кастомную функцию LOWER для поддержки кириллицы в SQLite
if 'sqlite' in DATABASES['default']['ENGINE']:
from django.db.backends.signals import connection_created
from django.dispatch import receiver
@receiver(connection_created)
def setup_sqlite_unicode_support(sender, connection, **kwargs):
"""Добавляет поддержку Unicode для LOWER() в SQLite"""
if connection.vendor == 'sqlite':
connection.connection.create_function('LOWER', 1, lambda s: s.lower() if s else s)