Copied Chris' code to get genre graph working
This commit is contained in:
@@ -211,7 +211,7 @@ def get_artist_data(request, user_secret):
|
||||
filter=Q(track__users=user)))
|
||||
processed_artist_counts = [{'name': artist.name, 'num_songs': artist.num_songs}
|
||||
for artist in artist_counts]
|
||||
pprint.pprint(processed_artist_counts)
|
||||
pprint(processed_artist_counts)
|
||||
return JsonResponse(data=processed_artist_counts, safe=False)
|
||||
|
||||
# }}} get_artist_data #
|
||||
@@ -257,7 +257,7 @@ def get_genre_data(request, user_secret):
|
||||
genre_dict['artists'] = get_artists_in_genre(user, genre_dict['genre'],
|
||||
genre_dict['num_songs'])
|
||||
print("*** Genre Breakdown ***")
|
||||
pprint.pprint(list(genre_counts))
|
||||
pprint(list(genre_counts))
|
||||
return JsonResponse(data=list(genre_counts), safe=False)
|
||||
|
||||
# }}} get_genre_data #
|
||||
|
||||
@@ -46,16 +46,7 @@
|
||||
var y = d3.scaleLinear()
|
||||
.rangeRound([height, 0]);
|
||||
|
||||
// PU: trying to store genreData locally
|
||||
var genreData;
|
||||
d3.json("{% url "api:get_genre_data" user_secret %}",
|
||||
function(data) {
|
||||
genreData = data;
|
||||
}
|
||||
);
|
||||
console.log(genreData);
|
||||
create_genre_graph(genreData);
|
||||
// d3.json("{% url "api:get_genre_data" user_secret %}").then(create_genre_graph);
|
||||
d3.json("{% url "api:get_genre_data" user_secret %}").then(create_genre_graph);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -10,8 +10,5 @@ urlpatterns = [
|
||||
name='display_genre_graph'),
|
||||
path('audio_features/<str:user_secret>', display_features_graphs,
|
||||
name='display_audio_features'),
|
||||
# path('history/<str:user_secret>', display_history_table,
|
||||
# name='display_history_table'),
|
||||
# path('history/', display_history_table, name='display_history_table'),
|
||||
path('history/', HistoryList.as_view(), name='display_history_table'),
|
||||
]
|
||||
|
||||
@@ -10,8 +10,8 @@ class HistoryTable(tables.Table):
|
||||
template_name = 'django_tables2/bootstrap.html'
|
||||
|
||||
iso_timestamp = tables.Column(accessor='get_iso_timestamp', orderable=False)
|
||||
track_name = tables.Column(accessor='track.name', orderable=False)
|
||||
track_id = tables.Column(accessor='track.id', orderable=False)
|
||||
track_name = tables.Column(accessor='track.name', orderable=False)
|
||||
artists = tables.Column(accessor='get_artists', orderable=False)
|
||||
|
||||
def get_secret_context(user_secret):
|
||||
|
||||
Reference in New Issue
Block a user