carom-server/billard/models.py

53 lines
2.0 KiB
Python
Raw Normal View History

2017-01-03 19:26:51 +01:00
from django.db import models
2017-02-01 13:51:15 +01:00
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(default=False)
error_msg = models.CharField(max_length=16000, blank=True, null=True)
2017-01-03 19:26:51 +01:00
2017-01-06 18:53:26 +01:00
def __str__(self):
2017-02-01 13:51:15 +01:00
return str(self.location_id)
2017-01-06 18:53:26 +01:00
def __unicode__(self):
2017-02-01 13:51:15 +01:00
return str(self.location_id)
2017-01-06 18:53:26 +01:00
2017-01-03 20:13:47 +01:00
2017-02-01 13:51:15 +01:00
class Location(models.Model):
code = models.CharField(max_length=16, unique=True)
name = models.CharField(max_length=64, unique=True)
street = models.CharField(max_length=64, blank=True, null=True)
plz = models.CharField(max_length=8, blank=True, null=True)
city = models.CharField(max_length=64, blank=True, null=True)
phone = models.CharField(max_length=64, blank=True, null=True)
email = models.EmailField(blank=True, null=True)
url = models.URLField(blank=True,null=True)
2017-01-03 19:26:51 +01:00
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-02-01 13:51:15 +01:00
class Client(models.Model):
id = models.UUIDField(primary_key=True, editable=False)
location = models.ForeignKey(Location)
desk1_enable = models.BooleanField()
desk1_name = models.CharField(max_length=32, blank=True, null=True)
desk1_prize_nt = models.DecimalField(max_digits=4, decimal_places=2, blank=True, null=True)
desk1_prize_ht = models.DecimalField(max_digits=4, decimal_places=2, blank=True, null=True)
desk2_enable = models.BooleanField()
desk2_name = models.CharField(max_length=32, blank=True, null=True)
desk2_prize_nt = models.DecimalField(max_digits=4, decimal_places=2, blank=True, null=True)
desk2_prize_ht = models.DecimalField(max_digits=4, decimal_places=2, blank=True, null=True)
2017-01-06 18:53:26 +01:00
def __str__(self):
return self.name
def __unicode__(self):
return self.name