Private
Public Access
1
0
This commit is contained in:
Sander Roosendaal
2021-02-13 17:25:29 +01:00
parent c93c3a51e5
commit 5c5000a7b4
3 changed files with 339 additions and 322 deletions

View File

@@ -2301,6 +2301,15 @@ class PlannedSession(models.Model):
return stri
def update_json(self):
# read file
if self.fitfile:
steps = steps_read_fit(settings.MEDIA_ROOT+'/'+self.fitfile.name)
self.steps_json = json.dumps(steps)
self.save()
def save(self, *args, **kwargs):
if self.sessionvalue <= 0:
self.sessionvalue = 1
@@ -2359,8 +2368,7 @@ class PlannedSession(models.Model):
if self.preferreddate < self.startdate:
self.preferreddate = self.startdate
print(self.fitfile)
super(PlannedSession,self).save(*args, **kwargs)
#super(PlannedSession,self).save(*args, **kwargs)
# read file
if self.fitfile:
@@ -2370,11 +2378,8 @@ class PlannedSession(models.Model):
steps = steps_read_fit(settings.MEDIA_ROOT+'/'+self.fitfile.name)
self.steps_json = json.dumps(steps)
try:
super(PlannedSession,self).save(*args, **kwargs)
except:
pass
super(PlannedSession,self).save(*args, **kwargs)
from django.core.validators import RegexValidator,validate_email