Refactor saving History obj

From import_history and parse_history. Also refactor getting CSV
information from import_history.
This commit is contained in:
2018-11-08 09:39:10 -05:00
parent f54eb4a814
commit 3d0acc7a4b
4 changed files with 64 additions and 35 deletions

View File

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

View File

@@ -65,6 +65,7 @@ class HistoryList(ExportMixin, SingleTableView):
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['user_id'] = self.request.session['user_id']
context['total_history'] = self.get_table_data().count()
return context
def get_export_filename(self, export_format):