diff --git a/core/__pycache__/settings.cpython-311.pyc b/core/__pycache__/settings.cpython-311.pyc index f485ab4..f9edf40 100644 Binary files a/core/__pycache__/settings.cpython-311.pyc and b/core/__pycache__/settings.cpython-311.pyc differ diff --git a/core/settings.py b/core/settings.py index a68896d..cbce9fd 100644 --- a/core/settings.py +++ b/core/settings.py @@ -80,12 +80,6 @@ DATABASES = { } } -# добавил от жемени из за нжинкса - -CSRF_TRUSTED_ORIGINS = [ - "http://192.168.1.57:8080", - "https://shop.tertelius.space", # Сразу добавь на будущее -] # Password validation # https://docs.djangoproject.com/en/5.2/ref/settings/#auth-password-validators @@ -109,9 +103,11 @@ AUTH_PASSWORD_VALIDATORS = [ # Internationalization # https://docs.djangoproject.com/en/5.2/topics/i18n/ -LANGUAGE_CODE = 'en-us' +# LANGUAGE_CODE = 'en-us' +LANGUAGE_CODE = 'ru-ru' -TIME_ZONE = 'UTC' +# TIME_ZONE = 'UTC' +TIME_ZONE = 'Europe/Moscow' USE_I18N = True @@ -132,3 +128,10 @@ MEDIA_ROOT = os.path.join(BASE_DIR, 'media') # https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' + +# добавил от жемени из за нжинкса + +CSRF_TRUSTED_ORIGINS = [ + "http://192.168.1.57:8080", + "https://shop.tertelius.space", # Сразу добавь на будущее +] diff --git a/entrypoint.sh b/entrypoint.sh index 3338e8b..ae18aca 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -4,6 +4,10 @@ echo "Collecting static files..." python manage.py collectstatic --noinput +# Применяем миграции базы данных +echo "Applying database migrations..." +python manage.py migrate --noinput + # Запускаем основную команду (Gunicorn) echo "Starting Gunicorn..." exec "$@" \ No newline at end of file diff --git a/products/__pycache__/admin.cpython-311.pyc b/products/__pycache__/admin.cpython-311.pyc index 7aa5d53..79143ee 100644 Binary files a/products/__pycache__/admin.cpython-311.pyc and b/products/__pycache__/admin.cpython-311.pyc differ diff --git a/products/__pycache__/models.cpython-311.pyc b/products/__pycache__/models.cpython-311.pyc index d62b39d..dcdb30c 100644 Binary files a/products/__pycache__/models.cpython-311.pyc and b/products/__pycache__/models.cpython-311.pyc differ diff --git a/products/admin.py b/products/admin.py index ac78e51..38a79c7 100644 --- a/products/admin.py +++ b/products/admin.py @@ -3,4 +3,6 @@ from .models import Product @admin.register(Product) class ProductAdmin(admin.ModelAdmin): - list_display = ('name', 'price', 'weight') \ No newline at end of file + # Убираем 'weight', добавляем 'image' + list_display = ('name', 'price', 'image') + search_fields = ('name',) \ No newline at end of file diff --git a/products/migrations/0002_remove_product_weight_product_description_and_more.py b/products/migrations/0002_remove_product_weight_product_description_and_more.py new file mode 100644 index 0000000..e7c0eb8 --- /dev/null +++ b/products/migrations/0002_remove_product_weight_product_description_and_more.py @@ -0,0 +1,33 @@ +# Generated by Django 5.2.10 on 2026-01-21 02:01 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('products', '0001_initial'), + ] + + operations = [ + migrations.RemoveField( + model_name='product', + name='weight', + ), + migrations.AddField( + model_name='product', + name='description', + field=models.TextField(default=1, verbose_name='Описание'), + preserve_default=False, + ), + migrations.AddField( + model_name='product', + name='image', + field=models.ImageField(blank=True, null=True, upload_to='products/', verbose_name='Изображение'), + ), + migrations.AlterField( + model_name='product', + name='name', + field=models.CharField(max_length=200, verbose_name='Название'), + ), + ] diff --git a/products/models.py b/products/models.py index b480265..354db2d 100644 --- a/products/models.py +++ b/products/models.py @@ -1,9 +1,10 @@ from django.db import models class Product(models.Model): - name = models.CharField(max_length=255, verbose_name="Название") + name = models.CharField(max_length=200, verbose_name="Название") + description = models.TextField(verbose_name="Описание") price = models.DecimalField(max_digits=10, decimal_places=2, verbose_name="Цена") - weight = models.FloatField(verbose_name="Вес (кг)") + image = models.ImageField(upload_to='products/', null=True, blank=True, verbose_name="Изображение") def __str__(self): return self.name \ No newline at end of file diff --git a/products/templates/products/list.html b/products/templates/products/list.html index 18387ba..60e7ed4 100644 --- a/products/templates/products/list.html +++ b/products/templates/products/list.html @@ -1,8 +1,33 @@ -
{{ product.description }}
+Цена: {{ product.price }} руб.
+ {% if product.image %} +Нет изображения
+ {% endif %} +Товаров пока нет.
+ {% endfor %} + + \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 23975e2..d32322a 100644 Binary files a/requirements.txt and b/requirements.txt differ