summaryrefslogtreecommitdiff
path: root/nop/models.py
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2017-01-12 17:28:03 (GMT)
committerChristian Pointner <equinox@helsinki.at>2017-01-12 17:28:03 (GMT)
commit82204a17ee6feda5fcf4d376ef05bb9f4a8844c5 (patch)
treed6db4a53fb1b45af0a2420ba22388c401c28b10e /nop/models.py
parentbee4dba4ed6c8519a9a87027d20d3c3f284ec7fa (diff)
parent1db5125c61ed8ed050b01b7d0944569727a39e48 (diff)
Merge branch 'master' into stable
Diffstat (limited to 'nop/models.py')
-rw-r--r--nop/models.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/nop/models.py b/nop/models.py
index 1b39eed..e9b23e6 100644
--- a/nop/models.py
+++ b/nop/models.py
@@ -1,5 +1,16 @@
from django.db import models
+class CartTypeField(models.Field):
+ def __init__(self, *args, **kwargs):
+ self.types = [('show', 'Show'),
+ ('pool', 'Musicpool'),
+ ('jingle', 'Jingle'),
+ ]
+ super(CartTypeField, self).__init__(*args, **kwargs)
+
+ def db_type(self, connection):
+ return "ENUM({})".format(','.join("'{}'".format(col)
+ for col, _ in self.types))
class Master(models.Model):
timestamp = models.BigIntegerField(primary_key=True)
@@ -9,7 +20,7 @@ class Master(models.Model):
title = models.CharField(max_length=765, blank=True)
artist = models.CharField(max_length=765, blank=True)
album = models.CharField(max_length=765, blank=True)
- ismusic = models.IntegerField(null=True, blank=True)
+ carttype = CartTypeField(max_length=64, blank=True)
class Meta:
db_table = u'master'
@@ -24,7 +35,7 @@ class Standby(models.Model):
title = models.CharField(max_length=765, blank=True)
artist = models.CharField(max_length=765, blank=True)
album = models.CharField(max_length=765, blank=True)
- ismusic = models.IntegerField(null=True, blank=True)
+ carttype = CartTypeField(max_length=64, blank=True)
class Meta:
db_table = u'standby'