Fixes on arrows in the main screen

This commit is contained in:
oslomp
2018-12-16 21:39:11 +01:00
parent 6adbecec9c
commit 6cf1b4bef2
3 changed files with 23 additions and 5 deletions

View File

@ -53,8 +53,12 @@ class PlaylistSong(models.Model):
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)
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
self.save()
other_song.save()
def switch_order(self, other_song):
old_id = self.id