rancher setub

This commit is contained in:
2025-08-03 16:03:01 +03:30
parent 6ccbadbbdc
commit 57d1034024
13 changed files with 210 additions and 9 deletions

View File

@@ -10,6 +10,12 @@ class Herd(BaseModel):
related_name='herd',
null=True
)
rancher = models.ForeignKey(
'Rancher',
on_delete=models.CASCADE,
related_name='herd',
null=True
)
cooperative = models.ForeignKey(
auth_models.Organization,
on_delete=models.CASCADE,
@@ -72,3 +78,34 @@ class Herd(BaseModel):
def save(self, *args, **kwargs):
super(Herd, self).save(*args, **kwargs)
class Rancher(BaseModel):
ranching_farm = models.CharField(max_length=150, null=True)
first_name = models.CharField(max_length=150, null=True)
last_name = models.CharField(max_length=150, null=True)
mobile = models.CharField(max_length=25, null=True)
national_code = models.CharField(max_length=20, null=True)
birthdate = models.DateTimeField(null=True)
nationality = models.CharField(max_length=20, null=True)
address = models.TextField(blank=True)
province = models.ForeignKey(
auth_models.Province,
on_delete=models.CASCADE,
related_name='ranchers',
null=True
)
city = models.ForeignKey(
auth_models.City,
on_delete=models.CASCADE,
related_name='ranchers',
null=True
)
without_herd = models.BooleanField(default=False)
def __str__(self):
return f'rancher: {self.first_name} {self.last_name}'
def save(self, *args, **kwargs):
return super(Rancher, self).save(*args, **kwargs)