from django.db import models class Location(models.Model): name = models.CharField(max_length=30, unique=True) def __str__(self): return self.name def __unicode__(self): return self.name class Client(models.Model): id = models.UUIDField(primary_key=True, editable=False) location = models.ForeignKey(Location) def __str__(self): return self.name def __unicode__(self): return self.name class Table(models.Model): client = models.ForeignKey(Client) number = models.IntegerField() name = models.CharField(max_length=30) def __str__(self): return self.name def __unicode__(self): return self.name class LocationData(models.Model): location_id = models.CharField(max_length=32, blank=False, null=False) table_no = models.IntegerField(blank=False, null=False) tst = models.DateTimeField(blank=False, null=False) on_off = models.BooleanField(blank=False, null=False) processed = models.BooleanField(blank=False, null=False, default=False) error_msg = models.CharField(max_length=16000, blank=True, null=True) def __str__(self): return str(self.location_id) def __unicode__(self): return str(self.location_id)