Templates -> Library in many (all?) places
This commit is contained in:
@@ -25,6 +25,7 @@ import twitter
|
|||||||
import re
|
import re
|
||||||
import pytz
|
import pytz
|
||||||
from django_countries.fields import CountryField
|
from django_countries.fields import CountryField
|
||||||
|
import tempfile
|
||||||
|
|
||||||
from scipy.interpolate import splprep, splev, CubicSpline,interp1d
|
from scipy.interpolate import splprep, splev, CubicSpline,interp1d
|
||||||
|
|
||||||
@@ -2385,7 +2386,11 @@ class PlannedSession(models.Model):
|
|||||||
self.steps_json = json.dumps(steps)
|
self.steps_json = json.dumps(steps)
|
||||||
|
|
||||||
if self.steps_json and not self.fitfile:
|
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 = json.loads(self.steps_json)
|
||||||
steps['filename'] = filename
|
steps['filename'] = filename
|
||||||
fitfile = steps_write_fit(steps)
|
fitfile = steps_write_fit(steps)
|
||||||
@@ -2597,6 +2602,7 @@ class PlannedSessionTemplateForm(ModelForm):
|
|||||||
model = PlannedSession
|
model = PlannedSession
|
||||||
fields = [
|
fields = [
|
||||||
'name',
|
'name',
|
||||||
|
'sessionsport',
|
||||||
'sessiontype',
|
'sessiontype',
|
||||||
'sessionmode',
|
'sessionmode',
|
||||||
'criterium',
|
'criterium',
|
||||||
@@ -2604,6 +2610,8 @@ class PlannedSessionTemplateForm(ModelForm):
|
|||||||
'sessionunit',
|
'sessionunit',
|
||||||
'course',
|
'course',
|
||||||
'comment',
|
'comment',
|
||||||
|
'interval_string',
|
||||||
|
'fitfile'
|
||||||
]
|
]
|
||||||
|
|
||||||
dateTimeOptions = {
|
dateTimeOptions = {
|
||||||
@@ -2613,6 +2621,7 @@ class PlannedSessionTemplateForm(ModelForm):
|
|||||||
|
|
||||||
widgets = {
|
widgets = {
|
||||||
'comment': forms.Textarea,
|
'comment': forms.Textarea,
|
||||||
|
'interval_string':forms.Textarea(attrs={'rows':2, 'cols':50})
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self,*args,**kwargs):
|
def __init__(self,*args,**kwargs):
|
||||||
|
|||||||
@@ -60,7 +60,7 @@
|
|||||||
<th>Edit</th>
|
<th>Edit</th>
|
||||||
<th>Clone</th>
|
<th>Clone</th>
|
||||||
<th>Delete</th>
|
<th>Delete</th>
|
||||||
<th>Template</th>
|
<th>Library</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@@ -90,7 +90,7 @@
|
|||||||
<a class="small" href="/rowers/sessions/{{ ps.id }}/deleteconfirm/">Delete</a>
|
<a class="small" href="/rowers/sessions/{{ ps.id }}/deleteconfirm/">Delete</a>
|
||||||
</td>
|
</td>
|
||||||
<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>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
@@ -98,7 +98,7 @@
|
|||||||
</table>
|
</table>
|
||||||
</li>
|
</li>
|
||||||
<li class="grid_2">
|
<li class="grid_2">
|
||||||
<h1>Templates</h1>
|
<h1>Session Library</h1>
|
||||||
<p>
|
<p>
|
||||||
Click on session name to clone to current period
|
Click on session name to clone to current period
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@@ -111,7 +111,7 @@
|
|||||||
</table>
|
</table>
|
||||||
</li>
|
</li>
|
||||||
<li class="grid_2">
|
<li class="grid_2">
|
||||||
<h1>Templates</h1>
|
<h1>Session Library</h1>
|
||||||
<p>
|
<p>
|
||||||
Click on session name to clone to current period
|
Click on session name to clone to current period
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@@ -95,7 +95,7 @@
|
|||||||
<a class="small" href="/rowers/sessions/{{ ps.id }}/deleteconfirm/">Delete</a>
|
<a class="small" href="/rowers/sessions/{{ ps.id }}/deleteconfirm/">Delete</a>
|
||||||
</td>
|
</td>
|
||||||
<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>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
@@ -105,7 +105,7 @@
|
|||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<li class="grid_2">
|
<li class="grid_2">
|
||||||
<h1>Templates</h1>
|
<h1>Session Library</h1>
|
||||||
<p>
|
<p>
|
||||||
Click on session name to clone to current period
|
Click on session name to clone to current period
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
{% load staticfiles %}
|
{% load staticfiles %}
|
||||||
{% load rowerfilters %}
|
{% load rowerfilters %}
|
||||||
|
|
||||||
{% block title %}Update Template Session{% endblock %}
|
{% block title %}Update Library Session{% endblock %}
|
||||||
|
|
||||||
{% block main %}
|
{% block main %}
|
||||||
<h1>Edit Session Template</h1>
|
<h1>Edit Session Template</h1>
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
</li>
|
</li>
|
||||||
<li class="grid_2">
|
<li class="grid_2">
|
||||||
<h1>Templates</h1>
|
<h1>Library</h1>
|
||||||
<p>
|
<p>
|
||||||
Click on session name to clone to current period
|
Click on session name to clone to current period
|
||||||
</p>
|
</p>
|
||||||
@@ -65,7 +65,7 @@
|
|||||||
<td> {{ ps.sessionvalue }} </td>
|
<td> {{ ps.sessionvalue }} </td>
|
||||||
<td> {{ ps.sessionunit }} </td>
|
<td> {{ ps.sessionunit }} </td>
|
||||||
<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>
|
||||||
<td>
|
<td>
|
||||||
<a class="small" href="/rowers/sessions/{{ ps.id }}/deleteconfirm/">Delete</a>
|
<a class="small" href="/rowers/sessions/{{ ps.id }}/deleteconfirm/">Delete</a>
|
||||||
|
|||||||
Reference in New Issue
Block a user