Added timestamp to exported history filename (#57)
This commit is contained in:
@@ -265,6 +265,9 @@ def import_history(request, upload_id):
|
||||
# }}} setup #
|
||||
|
||||
history_obj_info_lst.append(history_obj_info)
|
||||
# PU: refactor saving History object right away if Track obj already
|
||||
# exists
|
||||
# PU: refactor below?
|
||||
rows_read += 1
|
||||
if (rows_read % TRACKS_LIMIT == 0) or last_row:
|
||||
# get tracks_response {{{ #
|
||||
|
||||
@@ -6,10 +6,11 @@ import requests
|
||||
import os
|
||||
import urllib
|
||||
import secrets
|
||||
from pprint import pprint
|
||||
import string
|
||||
from datetime import datetime
|
||||
|
||||
from pprint import pprint
|
||||
from datetime import datetime
|
||||
from time import strftime
|
||||
from django.shortcuts import render, redirect
|
||||
from .utils import *
|
||||
from django_tables2 import RequestConfig, SingleTableView
|
||||
@@ -69,7 +70,9 @@ class HistoryList(ExportMixin, SingleTableView):
|
||||
return context
|
||||
|
||||
def get_export_filename(self, export_format):
|
||||
return "{}.{}".format(self.request.session['user_id'], export_format)
|
||||
user_id = self.request.session['user_id']
|
||||
timestamp = strftime("%m%d%Y-%H%M")
|
||||
return "{}.{}".format("-".join((user_id, timestamp)), export_format)
|
||||
|
||||
def create_export(self, export_format):
|
||||
export_exclude = ('id', 'user', 'track', 'track_name', 'artists',
|
||||
|
||||
Reference in New Issue
Block a user