change livestock types weight

This commit is contained in:
2025-07-14 11:38:46 +03:30
parent 2c0e55a616
commit a5ce81efe7
4 changed files with 31 additions and 1 deletions

View File

@@ -0,0 +1,18 @@
# Generated by Django 5.0 on 2025-07-14 08:04
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('livestock', '0011_remove_livestock_age_by_day_and_more'),
]
operations = [
migrations.AddField(
model_name='livestocktype',
name='weight_type',
field=models.CharField(choices=[('L', 'Light'), ('H', 'Heavy')], max_length=50, null=True),
),
]

View File

@@ -18,6 +18,15 @@ class LiveStockSpecies(BaseModel): # noqa
class LiveStockType(BaseModel): # noqa class LiveStockType(BaseModel): # noqa
""" types like sheep, cow, camel, etc """ """ types like sheep, cow, camel, etc """
name = models.CharField(max_length=50) name = models.CharField(max_length=50)
weight_types = (
('L', 'Light'),
('H', 'Heavy')
)
weight_type = models.CharField(
choices=weight_types,
max_length=50,
null=True
)
def __str__(self): def __str__(self):
return f'{self.name}' return f'{self.name}'

View File

@@ -9,7 +9,8 @@ class LiveStockTypeSerializer(serializers.ModelSerializer):
model = livestock_models.LiveStockType model = livestock_models.LiveStockType
fields = [ fields = [
'id', 'id',
'name' 'name',
'weight_type'
] ]

View File

@@ -9,6 +9,8 @@ from rest_framework import status
from django.db import transaction from django.db import transaction
from django.db.models import Q from django.db.models import Q
from datetime import datetime from datetime import datetime
from asgiref.sync import sync_to_async, async_to_sync
from django.http import JsonResponse
def trash(queryset, pk): # noqa def trash(queryset, pk): # noqa