2017-01-03 19:26:51 +01:00
|
|
|
from django.db import models
|
|
|
|
|
|
|
|
|
|
|
|
class Location(models.Model):
|
|
|
|
name = models.CharField(max_length=30, unique=True)
|
|
|
|
|
2017-01-06 18:53:26 +01:00
|
|
|
def __str__(self):
|
|
|
|
return self.name
|
|
|
|
|
|
|
|
def __unicode__(self):
|
|
|
|
return self.name
|
|
|
|
|
2017-01-03 20:13:47 +01:00
|
|
|
|
2017-01-03 19:26:51 +01:00
|
|
|
class Client(models.Model):
|
|
|
|
id = models.UUIDField(primary_key=True, editable=False)
|
|
|
|
location = models.ForeignKey(Location)
|
|
|
|
|
2017-01-06 18:53:26 +01:00
|
|
|
def __str__(self):
|
|
|
|
return self.name
|
|
|
|
|
|
|
|
def __unicode__(self):
|
|
|
|
return self.name
|
|
|
|
|
2017-01-03 20:13:47 +01:00
|
|
|
|
2017-01-03 19:26:51 +01:00
|
|
|
class Table(models.Model):
|
|
|
|
client = models.ForeignKey(Client)
|
|
|
|
number = models.IntegerField()
|
|
|
|
name = models.CharField(max_length=30)
|
2017-01-06 18:53:26 +01:00
|
|
|
|
|
|
|
def __str__(self):
|
|
|
|
return self.name
|
|
|
|
|
|
|
|
def __unicode__(self):
|
|
|
|
return self.name
|
2017-01-06 19:11:29 +01:00
|
|
|
|
|
|
|
|
2017-01-06 20:24:36 +01:00
|
|
|
class LocationData(models.Model):
|
|
|
|
location_id = models.CharField(max_length=32, blank=False, null=False)
|
2017-01-06 19:11:29 +01:00
|
|
|
table_no = models.IntegerField(blank=False, null=False)
|
|
|
|
tst = models.DateTimeField(blank=False, null=False)
|
|
|
|
on_off = models.BooleanField(blank=False, null=False)
|
2017-01-09 18:40:36 +01:00
|
|
|
processed = models.BooleanField(default=False)
|
2017-01-09 15:37:25 +01:00
|
|
|
error_msg = models.CharField(max_length=16000, blank=True, null=True)
|
2017-01-06 19:11:29 +01:00
|
|
|
|
|
|
|
def __str__(self):
|
2017-01-06 20:16:21 +01:00
|
|
|
return str(self.location_id)
|
2017-01-06 19:11:29 +01:00
|
|
|
|
|
|
|
def __unicode__(self):
|
2017-01-06 20:16:21 +01:00
|
|
|
return str(self.location_id)
|