diff --git a/marietje/queues/migrations/0007_song_state_choices.py b/marietje/queues/migrations/0007_song_state_choices.py new file mode 100644 index 0000000..7c15c5a --- /dev/null +++ b/marietje/queues/migrations/0007_song_state_choices.py @@ -0,0 +1,18 @@ +# Generated by Django 2.1.2 on 2018-11-23 15:25 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('queues', '0006_state_db_index'), + ] + + operations = [ + migrations.AlterField( + model_name='playlistsong', + name='state', + field=models.IntegerField(choices=[(0, 'Queued'), (1, 'Playing'), (2, 'Played'), (3, 'Cancelled')], db_index=True, default=0), + ), + ] diff --git a/marietje/queues/models.py b/marietje/queues/models.py index e624734..6ed5ab2 100644 --- a/marietje/queues/models.py +++ b/marietje/queues/models.py @@ -36,7 +36,13 @@ class PlaylistSong(models.Model): # 1: Playing. # 2: Played. # 3: Cancelled. - state = models.IntegerField(default=0, db_index=True) + STATECHOICE = ( + (0, 'Queued'), + (1, 'Playing'), + (2, 'Played'), + (3, 'Cancelled'), + ) + state = models.IntegerField(default=0, db_index=True, choices=STATECHOICE) def move_up(self): other_song = PlaylistSong.objects.filter(playlist=self.playlist, id__lt=self.id)\