Add check to song request to make sure song exists.
This commit is contained in:
parent
bb493548cb
commit
bf88b8cfdc
1 changed files with 4 additions and 1 deletions
|
@ -48,7 +48,10 @@ class RadioProfile(Disableable, Timestampable, models.Model):
|
|||
|
||||
def make_request(self, song_requested):
|
||||
if isinstance(song_requested, int):
|
||||
try:
|
||||
song = Song.objects.get(pk=song_requested)
|
||||
except Song.DoesNotExist:
|
||||
raise MakeRequestError('Song does not exist.')
|
||||
else:
|
||||
song = song_requested
|
||||
|
||||
|
|
Loading…
Reference in a new issue