From 70f0e4fb4c47e2c288be8f5b8e6d2c7caa7b4157 Mon Sep 17 00:00:00 2001 From: Andrey Smakotin Date: Mon, 5 Jan 2026 21:30:10 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B0=20=D0=BC=D0=B8=D0=B3=D1=80=D0=B0=D1=86=D0=B8=D1=8F?= =?UTF-8?q?=20=D0=B4=D0=BB=D1=8F=20CheckConstraint=20=D0=B2=20OrderStatus?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Проверка что статус не может быть одновременно позитивным и негативным концом --- ...atus_not_both_positive_and_negative_end.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 myproject/orders/migrations/0004_orderstatus_not_both_positive_and_negative_end.py diff --git a/myproject/orders/migrations/0004_orderstatus_not_both_positive_and_negative_end.py b/myproject/orders/migrations/0004_orderstatus_not_both_positive_and_negative_end.py new file mode 100644 index 0000000..29d75ef --- /dev/null +++ b/myproject/orders/migrations/0004_orderstatus_not_both_positive_and_negative_end.py @@ -0,0 +1,19 @@ +# Generated by Django 5.0.10 on 2026-01-05 14:00 + +from django.conf import settings +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('orders', '0003_allow_null_delivery_date_for_drafts'), + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ] + + operations = [ + migrations.AddConstraint( + model_name='orderstatus', + constraint=models.CheckConstraint(check=models.Q(('is_positive_end', True), ('is_negative_end', True), _negated=True), name='not_both_positive_and_negative_end', violation_error_message='Статус не может быть одновременно положительным и отрицательным концом'), + ), + ]