Templates -> Library in many (all?) places
This commit is contained in:
@@ -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):
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
<th>Edit</th>
|
||||
<th>Clone</th>
|
||||
<th>Delete</th>
|
||||
<th>Template</th>
|
||||
<th>Library</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -90,7 +90,7 @@
|
||||
<a class="small" href="/rowers/sessions/{{ ps.id }}/deleteconfirm/">Delete</a>
|
||||
</td>
|
||||
<td>
|
||||
<a class="small" href="/rowers/sessions/{{ ps.id }}/maketemplate/">Save</a>
|
||||
<a class="small" href="/rowers/sessions/{{ ps.id }}/maketemplate/">Save to Library</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
@@ -98,7 +98,7 @@
|
||||
</table>
|
||||
</li>
|
||||
<li class="grid_2">
|
||||
<h1>Templates</h1>
|
||||
<h1>Session Library</h1>
|
||||
<p>
|
||||
Click on session name to clone to current period
|
||||
</p>
|
||||
|
||||
@@ -111,7 +111,7 @@
|
||||
</table>
|
||||
</li>
|
||||
<li class="grid_2">
|
||||
<h1>Templates</h1>
|
||||
<h1>Session Library</h1>
|
||||
<p>
|
||||
Click on session name to clone to current period
|
||||
</p>
|
||||
|
||||
@@ -95,7 +95,7 @@
|
||||
<a class="small" href="/rowers/sessions/{{ ps.id }}/deleteconfirm/">Delete</a>
|
||||
</td>
|
||||
<td>
|
||||
<a class="small" href="/rowers/sessions/{{ ps.id }}/maketemplate/">Save</a>
|
||||
<a class="small" href="/rowers/sessions/{{ ps.id }}/maketemplate/">Save to Library</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
@@ -105,7 +105,7 @@
|
||||
</li>
|
||||
{% endif %}
|
||||
<li class="grid_2">
|
||||
<h1>Templates</h1>
|
||||
<h1>Session Library</h1>
|
||||
<p>
|
||||
Click on session name to clone to current period
|
||||
</p>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
{% load staticfiles %}
|
||||
{% load rowerfilters %}
|
||||
|
||||
{% block title %}Update Template Session{% endblock %}
|
||||
{% block title %}Update Library Session{% endblock %}
|
||||
|
||||
{% block main %}
|
||||
<h1>Edit Session Template</h1>
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
</li>
|
||||
<li class="grid_2">
|
||||
<h1>Templates</h1>
|
||||
<h1>Library</h1>
|
||||
<p>
|
||||
Click on session name to clone to current period
|
||||
</p>
|
||||
@@ -65,7 +65,7 @@
|
||||
<td> {{ ps.sessionvalue }} </td>
|
||||
<td> {{ ps.sessionunit }} </td>
|
||||
<td>
|
||||
<a class="small" href="/rowers/sessions/{{ ps.id }}/templateedit/">Edit Template</a>
|
||||
<a class="small" href="/rowers/sessions/{{ ps.id }}/templateedit/">Edit Library Session</a>
|
||||
</td>
|
||||
<td>
|
||||
<a class="small" href="/rowers/sessions/{{ ps.id }}/deleteconfirm/">Delete</a>
|
||||
|
||||
Reference in New Issue
Block a user