Skip to content
Snippets Groups Projects
Commit 11ff3ea5 authored by Christian Pointner's avatar Christian Pointner
Browse files

added support for new noplaying db format

parent bee4dba4
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,7 @@
from __future__ import unicode_literals
from django.db import migrations, models
import nop.models
class Migration(migrations.Migration):
......@@ -22,7 +23,7 @@ class Migration(migrations.Migration):
('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', nop.models.CartTypeField(max_length=64, blank=True)),
],
options={
'ordering': ['-timestamp'],
......@@ -39,7 +40,7 @@ class Migration(migrations.Migration):
('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', nop.models.CartTypeField(max_length=64, blank=True)),
],
options={
'ordering': ['-timestamp'],
......
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'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment