fix - improve response time of org linked ranchers

This commit is contained in:
2026-01-04 10:39:02 +03:30
parent abf1c12e39
commit 627075735c
4 changed files with 62 additions and 36 deletions

View File

@@ -1,7 +1,8 @@
from django.db import models
from apps.core.models import BaseModel
from apps.herd import models as herd_models
from apps.tag import models as tag_models
from django.db import models
class LiveStockSpecies(BaseModel): # noqa
@@ -53,6 +54,7 @@ class LiveStock(BaseModel):
herd_models.Herd,
on_delete=models.CASCADE,
related_name="live_stock_herd",
db_index=True,
null=True
)
tag = models.ForeignKey(
@@ -113,9 +115,9 @@ class TemporaryLiveStock(BaseModel):
null=True
)
count = models.PositiveBigIntegerField(default=0)
def __str__(self):
return f'temporary: {self.id} - rancher: {self.rancher.national_code}'
def save(self, *args, **kwargs):
return super(TemporaryLiveStock, self).save(*args, **kwargs)