diff --git a/apps/product/migrations/0046_remove_quotalivestockagelimitation_livestock_type.py b/apps/product/migrations/0046_remove_quotalivestockagelimitation_livestock_type.py new file mode 100644 index 0000000..d603503 --- /dev/null +++ b/apps/product/migrations/0046_remove_quotalivestockagelimitation_livestock_type.py @@ -0,0 +1,17 @@ +# Generated by Django 5.0 on 2025-07-14 09:01 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('product', '0045_quotalivestockallocation_livestock_type'), + ] + + operations = [ + migrations.RemoveField( + model_name='quotalivestockagelimitation', + name='livestock_type', + ), + ] diff --git a/apps/product/migrations/0047_quotalivestockagelimitation_livestock_type.py b/apps/product/migrations/0047_quotalivestockagelimitation_livestock_type.py new file mode 100644 index 0000000..7dec7a7 --- /dev/null +++ b/apps/product/migrations/0047_quotalivestockagelimitation_livestock_type.py @@ -0,0 +1,20 @@ +# Generated by Django 5.0 on 2025-07-14 09:04 + +import django.db.models.deletion +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('livestock', '0012_livestocktype_weight_type'), + ('product', '0046_remove_quotalivestockagelimitation_livestock_type'), + ] + + operations = [ + migrations.AddField( + model_name='quotalivestockagelimitation', + name='livestock_type', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='quota_limitations', to='livestock.livestocktype'), + ), + ] diff --git a/apps/product/models.py b/apps/product/models.py index 05e8363..856425e 100644 --- a/apps/product/models.py +++ b/apps/product/models.py @@ -458,7 +458,12 @@ class QuotaLiveStockAgeLimitation(BaseModel): related_name='livestock_age_limitations', null=True ) - livestock_type = models.CharField(max_length=20, choices=LivestockType.choices, null=True) + livestock_type = models.ForeignKey( + LiveStockType, + on_delete=models.CASCADE, + related_name='quota_limitations', + null=True + ) livestock_subtype = models.CharField(max_length=20, choices=LivestockSubtype.choices, null=True) age_month = models.PositiveIntegerField(default=0)