Visually separate regular and Marietje's queue

Original commit message:
Arrows and marietje part of queue updates
This commit is contained in:
oslomp
2019-01-11 13:11:25 +01:00
committed by Daan Sprenkels
parent d1bf9a1b90
commit 585485b130
5 changed files with 42 additions and 23 deletions

View File

@ -47,16 +47,9 @@ class PlaylistSong(models.Model):
)
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)\
.order_by('-id').first()
self.switch_order(other_song)
def move_down(self):
other_song = PlaylistSong.objects.filter(playlist=self.playlist, id__gt=self.id).order_by('id').first()
self.switch_order(other_song)
def switch_order(self, other_song):
other_song = PlaylistSong.objects.filter(playlist=self.playlist, id__gt=self.id).first()
old_id = self.id
self.id = other_song.id
other_song.id = old_id