diff --git a/rowers/models.py b/rowers/models.py index 4cc47bc3..bf9837b7 100644 --- a/rowers/models.py +++ b/rowers/models.py @@ -25,6 +25,7 @@ import twitter import re import pytz from django_countries.fields import CountryField +import tempfile from scipy.interpolate import splprep, splev, CubicSpline,interp1d @@ -2385,7 +2386,11 @@ class PlannedSession(models.Model): self.steps_json = json.dumps(steps) if self.steps_json and not self.fitfile: - filename = settings.MEDIA_ROOT+'/session'+encoder.encode_hex(self.id)+'.fit' + if self.pk is not None: + filename = settings.MEDIA_ROOT+'/session'+encoder.encode_hex(self.pk)+'.fit' + else: + file = tempfile.NamedTemporaryFile(mode='w+b',suffix='.fit',dir=settings.MEDIA_ROOT) + filename = file.name steps = json.loads(self.steps_json) steps['filename'] = filename fitfile = steps_write_fit(steps) @@ -2597,6 +2602,7 @@ class PlannedSessionTemplateForm(ModelForm): model = PlannedSession fields = [ 'name', + 'sessionsport', 'sessiontype', 'sessionmode', 'criterium', @@ -2604,6 +2610,8 @@ class PlannedSessionTemplateForm(ModelForm): 'sessionunit', 'course', 'comment', + 'interval_string', + 'fitfile' ] dateTimeOptions = { @@ -2613,6 +2621,7 @@ class PlannedSessionTemplateForm(ModelForm): widgets = { 'comment': forms.Textarea, + 'interval_string':forms.Textarea(attrs={'rows':2, 'cols':50}) } def __init__(self,*args,**kwargs): diff --git a/rowers/templates/plannedsessioncreate.html b/rowers/templates/plannedsessioncreate.html index 4f5b52ef..03c89c2b 100644 --- a/rowers/templates/plannedsessioncreate.html +++ b/rowers/templates/plannedsessioncreate.html @@ -60,7 +60,7 @@
Click on session name to clone to current period
diff --git a/rowers/templates/plannedsessionedit.html b/rowers/templates/plannedsessionedit.html index f5e04af5..b3443795 100644 --- a/rowers/templates/plannedsessionedit.html +++ b/rowers/templates/plannedsessionedit.html @@ -111,7 +111,7 @@Click on session name to clone to current period
diff --git a/rowers/templates/plannedsessionteamcreate.html b/rowers/templates/plannedsessionteamcreate.html index e9d3235c..fd0befc0 100644 --- a/rowers/templates/plannedsessionteamcreate.html +++ b/rowers/templates/plannedsessionteamcreate.html @@ -95,7 +95,7 @@ DeleteClick on session name to clone to current period
diff --git a/rowers/templates/plannedsessiontemplateedit.html b/rowers/templates/plannedsessiontemplateedit.html index 34dde816..d063cf6c 100644 --- a/rowers/templates/plannedsessiontemplateedit.html +++ b/rowers/templates/plannedsessiontemplateedit.html @@ -2,7 +2,7 @@ {% load staticfiles %} {% load rowerfilters %} -{% block title %}Update Template Session{% endblock %} +{% block title %}Update Library Session{% endblock %} {% block main %}Click on session name to clone to current period
@@ -65,7 +65,7 @@