import --> org multiple locations on create/edit/list & serialzier

This commit is contained in:
2026-02-08 14:09:03 +03:30
parent 84ea3b35d2
commit 8296214401
3 changed files with 60 additions and 3 deletions

View File

@@ -167,6 +167,23 @@ class Organization(BaseModel):
super(Organization, self).save(*args, **kwargs)
class OrganizationLocationInfo(BaseModel):
org = models.ForeignKey(
Organization,
on_delete=models.CASCADE,
related_name='locations',
null=True
)
postal_code = models.CharField(max_length=150, null=True, blank=True)
address = models.TextField(max_length=2000, null=True, blank=True)
def __str__(self):
return f'{self.org.name}-{self.postal_code}-{self.address}'
def save(self, *args, **kwargs):
super(OrganizationLocationInfo, self).save(*args, **kwargs)
class OrganizationStats(BaseModel):
organization = models.OneToOneField(
Organization,