mixr-api/api_v1/cafeteria/model.py

20 lines
560 B
Python
Raw Normal View History

import uuid
from django.db import models
from ..institution.model import Institution
from ..location.model import Location
class Cafeteria(models.Model):
cafeteria_id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
name = models.CharField(max_length=50, blank=False, null=False)
location = models.OneToOneField(Location, on_delete=models.DO_NOTHING)
website = models.URLField()
institutes = models.ManyToManyField(Institution)
def __str__(self):
return '{} ({})'.format(self.name, self.location)