Private
Public Access
1
0

better file names fit files

This commit is contained in:
Sander Roosendaal
2021-06-13 15:49:31 +02:00
parent 02029f8b6b
commit f3ae66f419
3 changed files with 6 additions and 2 deletions

View File

@@ -2507,10 +2507,12 @@ class PlannedSession(models.Model):
steps = steps_read_fit(os.path.join(settings.MEDIA_ROOT,self.fitfile.name))
self.steps = steps
if self.steps and not self.fitfile:
filename = 'aap.fit'
filename = get_file_path(self,filename)
steps = self.steps
steps['filename'] = os.path.join(settings.MEDIA_ROOT,filename)
fitfile = steps_write_fit(steps)

View File

@@ -140,8 +140,10 @@ def handle_uploaded_image(i): # pragma: no cover
def handle_uploaded_file(f):
fname = f.name
timestr = uuid.uuid4().hex[:10]+'-'+time.strftime("%Y%m%d-%H%M%S")
fname = timestr+'-'+fname
ext = fname.split('.')[-1]
fname = '%s.%s' % (uuid.uuid4(),ext)
#timestr = uuid.uuid4().hex[:10]+'-'+time.strftime("%Y%m%d-%H%M%S")
#fname = timestr+'-'+fname
fname2 = 'media/'+fname
with open(fname2,'wb+') as destination:
for chunk in f.chunks():

Binary file not shown.