22 lines
619 B
Python
22 lines
619 B
Python
import uuid
|
|
|
|
from django.db import models
|
|
|
|
from api_v1.location.model import Location
|
|
|
|
|
|
class Institution(models.Model):
|
|
institution_id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
|
|
|
|
name = models.CharField(max_length=150, blank=False, null=False)
|
|
description = models.TextField(null=True)
|
|
|
|
location = models.OneToOneField(Location, on_delete=models.DO_NOTHING, null=True, blank=True)
|
|
|
|
website = models.URLField(null=True)
|
|
|
|
def __str__(self):
|
|
result = self.name
|
|
if self.description:
|
|
result += f' - {self.description}'
|
|
return result
|