mirror of
https://gitlab.science.ru.nl/technicie/MarietjeDjango.git
synced 2025-12-10 09:12:23 +01:00
Visually separate regular and Marietje's queue
Original commit message: Arrows and marietje part of queue updates
This commit is contained in:
@ -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
|
||||
|
||||
Reference in New Issue
Block a user