Change URL pattern for retrieving audio feature data
Added 'api' as a prefix to make the URL consistent with the genre data retrieval URL.
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -14,6 +14,6 @@ urlpatterns = [
|
||||
path('graphs/genre/<str:client_secret>', display_genre_graph,
|
||||
name='display_genre_graph'),
|
||||
path('audio_features/<str:client_secret>', audio_features, name='audio_features'),
|
||||
path('audio_features/<str:audio_feature>/<str:client_secret>',
|
||||
path('api/audio_features/<str:audio_feature>/<str:client_secret>',
|
||||
get_audio_feature_data, name='get_audio_feature_data'),
|
||||
]
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user