import --> org multiple locations on create/edit/list & serialzier
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user