Fix incorrect usage of update()

update() is a QuerySet method. To update a single object, use save().
This commit is contained in:
Chris Shyi
2018-06-08 19:58:44 -04:00
parent 0e69d3d190
commit fd7a031bf2

View File

@@ -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 #