Browse Source

Fix incorrect usage of update()

update() is a QuerySet method. To update a single object, use save().
master
Chris Shyi 7 years ago
parent
commit
fd7a031bf2
  1. 3
      spotifyvis/utils.py

3
spotifyvis/utils.py

@ -310,7 +310,8 @@ def update_artist_genre(headers, artist_obj):
""" """
artist_response = requests.get('https://api.spotify.com/v1/artists/' + artist_obj.id, headers=headers).json() artist_response = requests.get('https://api.spotify.com/v1/artists/' + artist_obj.id, headers=headers).json()
# update genre for artist in database with top genre # update genre for artist in database with top genre
artist_obj.update(genre=artist_response['genres'][0])
artist_obj.genre = artist_response['genres'][0]
artist_obj.save()
# }}} calculate_genres_from_artists # # }}} calculate_genres_from_artists #

Loading…
Cancel
Save