From 2620eea779cbcb5de93e73f63b2cc31f5a8baccc Mon Sep 17 00:00:00 2001 From: Andrey Smakotin Date: Wed, 21 Jan 2026 00:37:11 +0300 Subject: [PATCH] =?UTF-8?q?feat(products):=20=D1=81=D0=B4=D0=B5=D0=BB?= =?UTF-8?q?=D0=B0=D1=82=D1=8C=20base=5Funit=20nullable=20=D0=B4=D0=BB?= =?UTF-8?q?=D1=8F=20=D1=82=D0=BE=D0=B2=D0=B0=D1=80=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Разрешить создание товаров без базовой единицы измерения. Co-Authored-By: Claude Opus 4.5 --- .../migrations/0005_base_unit_nullable.py | 19 +++++++++++++++++++ myproject/products/models/products.py | 2 ++ 2 files changed, 21 insertions(+) create mode 100644 myproject/products/migrations/0005_base_unit_nullable.py diff --git a/myproject/products/migrations/0005_base_unit_nullable.py b/myproject/products/migrations/0005_base_unit_nullable.py new file mode 100644 index 0000000..df2e93c --- /dev/null +++ b/myproject/products/migrations/0005_base_unit_nullable.py @@ -0,0 +1,19 @@ +# Generated by Django 5.0.10 on 2026-01-20 21:26 + +import django.db.models.deletion +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('products', '0004_add_unit_price_to_kit_item'), + ] + + operations = [ + migrations.AlterField( + model_name='product', + name='base_unit', + field=models.ForeignKey(blank=True, help_text='Единица хранения и закупки (банч, кг, шт). Товар принимается и хранится в этих единицах.', null=True, on_delete=django.db.models.deletion.PROTECT, related_name='products', to='products.unitofmeasure', verbose_name='Базовая единица'), + ), + ] diff --git a/myproject/products/models/products.py b/myproject/products/models/products.py index cdb066c..1d9c585 100644 --- a/myproject/products/models/products.py +++ b/myproject/products/models/products.py @@ -51,6 +51,8 @@ class Product(BaseProductEntity): on_delete=models.PROTECT, related_name='products', verbose_name="Базовая единица", + null=True, + blank=True, help_text="Единица хранения и закупки (банч, кг, шт). Товар принимается и хранится в этих единицах." )