Setup new page for user history
This commit is contained in:
@@ -16,5 +16,8 @@
|
||||
<a class="btn btn-primary" href="{% url "graphs:display_artist_graph" user_secret %}" role="button">
|
||||
Artists
|
||||
</a>
|
||||
<a class="btn btn-primary" href="{% url "graphs:display_history_table" user_secret %}" role="button">
|
||||
History
|
||||
</a>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
13
graphs/templates/graphs/user_history.html
Normal file
13
graphs/templates/graphs/user_history.html
Normal file
@@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
{% load static %}
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>User History</title>
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
|
||||
<link rel="stylesheet" href="{% static 'css/dark_bg.css' %}">
|
||||
</head>
|
||||
<body>
|
||||
<h1>Your Listening History</h1>
|
||||
</body>
|
||||
</html>
|
||||
@@ -10,4 +10,6 @@ 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'),
|
||||
]
|
||||
|
||||
@@ -6,3 +6,15 @@ def get_secret_context(user_secret):
|
||||
|
||||
"""
|
||||
return { 'user_secret': user_secret, }
|
||||
|
||||
|
||||
def get_user_history(user_secret):
|
||||
"""Return all stored history for corresponding User to user_secret.
|
||||
|
||||
:user_secret: User secret to get history for.
|
||||
:returns: list of lists of song history plus information.
|
||||
|
||||
"""
|
||||
# TODO: pass back user id as well?
|
||||
pass
|
||||
|
||||
|
||||
@@ -40,3 +40,14 @@ def display_features_graphs(request, user_secret):
|
||||
"""
|
||||
return render(request, "graphs/features_graphs.html",
|
||||
get_secret_context(user_secret))
|
||||
|
||||
def display_history_table(request, user_secret):
|
||||
"""Renders the user history page
|
||||
|
||||
:param request: the HTTP request
|
||||
:param user_secret: user secret used for identification
|
||||
:return: renders the user history page
|
||||
"""
|
||||
return render(request, "graphs/user_history.html",
|
||||
get_secret_context(user_secret))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user