diff --git a/spotifyvis/templates/spotifyvis/audio_features.html b/spotifyvis/templates/spotifyvis/audio_features.html index 47db0fd..bc53458 100644 --- a/spotifyvis/templates/spotifyvis/audio_features.html +++ b/spotifyvis/templates/spotifyvis/audio_features.html @@ -50,7 +50,7 @@ // define the vertical scaling function let vScale = d3.scaleLinear().range([height, 0]); - d3.json(`/audio_features/${audioFeature}/{{ user_secret }}`) + d3.json(`/api/audio_features/${audioFeature}/{{ user_secret }}`) .then(function(response) { // categorize the data points for (let dataPoint of response.data_points) { diff --git a/spotifyvis/urls.py b/spotifyvis/urls.py index 868f86b..c44840d 100644 --- a/spotifyvis/urls.py +++ b/spotifyvis/urls.py @@ -14,6 +14,6 @@ urlpatterns = [ path('graphs/genre/', display_genre_graph, name='display_genre_graph'), path('audio_features/', audio_features, name='audio_features'), - path('audio_features//', + path('api/audio_features//', get_audio_feature_data, name='get_audio_feature_data'), ] diff --git a/spotifyvis/views.py b/spotifyvis/views.py index d48acef..64a36bb 100644 --- a/spotifyvis/views.py +++ b/spotifyvis/views.py @@ -205,6 +205,12 @@ def display_genre_graph(request, client_secret): return render(request, "spotifyvis/genre_graph.html", context) def audio_features(request, client_secret): + """Renders the audio features page + + :param request: the HTTP request + :param client_secret: user secret used for identification + :return: renders the audio features page + """ user = User.objects.get(user_secret=client_secret) context = { 'user_id': user.user_id,