Able to upload history onto server (#57)

This commit is contained in:
2018-11-07 17:48:11 -05:00
parent df62fc21ee
commit a4a00458af
9 changed files with 53 additions and 2 deletions

View File

@@ -10,7 +10,7 @@
</head>
<body>
<h1>{{ user_id }}'s Listening History</h1>
<a class="btn btn-primary " href="{% export_url 'csv' %}" role="button">Export CSV</a>
<a class="btn btn-primary " href="{% export_url 'csv' %}" role="button">Export</a>
{% render_table user_history_table %}
</body>
</html>

View File

@@ -45,6 +45,8 @@ def display_features_graphs(request, user_secret):
return render(request, "graphs/features_graphs.html",
get_secret_context(user_secret))
# HistoryList {{{ #
class HistoryList(ExportMixin, SingleTableView):
"""Create table with list of song history."""
model = History
@@ -52,6 +54,8 @@ class HistoryList(ExportMixin, SingleTableView):
context_table_name = 'user_history_table'
template_name = 'graphs/user_history.html'
# overridden methods {{{ #
def get_table_kwargs(self):
return { 'exclude': ('id', 'user', 'track', 'track_id', 'iso_timestamp', ) }
@@ -76,3 +80,8 @@ class HistoryList(ExportMixin, SingleTableView):
)
return exporter.response(filename=self.get_export_filename(export_format))
# }}} overridden methods #
# }}} HistoryList #