Private
Public Access
1
0

adding cycle notes to training plan

This commit is contained in:
Sander Roosendaal
2018-10-31 13:20:09 +01:00
parent b4255c4e2a
commit eb773bb7e1
3 changed files with 29 additions and 0 deletions

View File

@@ -1101,6 +1101,12 @@ class TrainingPlanForm(ModelForm):
targetchoices = [(x.id,x) for x in targets] targetchoices = [(x.id,x) for x in targets]
targetchoices.append((None,'---')) targetchoices.append((None,'---'))
self.fields['target'].choices = targetchoices self.fields['target'].choices = targetchoices
elif self.instance.pk is not None:
self.fields['target'].queryset = TrainingTarget.objects.filter(
manager=self.instance.manager,
date__gte=datetime.date.today()).order_by("date")
else:
self.fields.pop('target')
try: try:
teams = Team.objects.filter(manager=self.instance.manager.user) teams = Team.objects.filter(manager=self.instance.manager.user)

View File

@@ -70,6 +70,13 @@
{{ macrocycle.0.name }} ({{ macrocycle.0.startdate }} - {{ macrocycle.0.enddate }}) {{ macrocycle.0.name }} ({{ macrocycle.0.startdate }} - {{ macrocycle.0.enddate }})
</th> </th>
</tr> </tr>
{% if macrocycle.0.notes %}
<tr>
<td colspan="4">
{{ macrocycle.0.notes|linebreaks }}
</td>
</tr>
{% endif %}
{% if macrocycle.0.type == 'userdefined' and macrocycle.0.plan.status %} {% if macrocycle.0.type == 'userdefined' and macrocycle.0.plan.status %}
<tr> <tr>
<td></td> <td></td>
@@ -180,6 +187,13 @@
Meso {{ mesocycle.0.name }} ({{ mesocycle.0.startdate }} - {{ mesocycle.0.enddate }}) Meso {{ mesocycle.0.name }} ({{ mesocycle.0.startdate }} - {{ mesocycle.0.enddate }})
</th> </th>
</tr> </tr>
{% if mesocycle.0.notes %}
<tr>
<td colspan="4">
{{ mesocycle.0.notes|linebreaks }}
</td>
</tr>
{% endif %}
{% if mesocycle.0.type == 'userdefined' and mesocycle.0.plan.plan.status %} {% if mesocycle.0.type == 'userdefined' and mesocycle.0.plan.plan.status %}
<tr> <tr>
<td></td> <td></td>
@@ -299,6 +313,13 @@
Micro {{ microcycle.name }} ({{ microcycle.startdate }} - {{ microcycle.enddate }}) Micro {{ microcycle.name }} ({{ microcycle.startdate }} - {{ microcycle.enddate }})
</th> </th>
</tr> </tr>
{% if microcycle.notes %}
<tr>
<td colspan="4">
{{ microcycle.notes|linebreaks }}
</td>
</tr>
{% endif %}
{% if microcycle.plan.plan.plan.status %} {% if microcycle.plan.plan.plan.status %}
<tr> <tr>
<td></td> <td></td>

View File

@@ -17011,6 +17011,8 @@ class TrainingPlanUpdate(UpdateView):
obj = super(TrainingPlanUpdate, self).get_object(*args, **kwargs) obj = super(TrainingPlanUpdate, self).get_object(*args, **kwargs)
if obj.manager is not None and self.request.user.rower != obj.manager: if obj.manager is not None and self.request.user.rower != obj.manager:
raise PermissionDenied('You are not allowed to edit this training plan cycle') raise PermissionDenied('You are not allowed to edit this training plan cycle')
if obj.manager.rowerplan not in ['coach','plan']:
raise PermissionDenied('You are not allowed to edit this training plan')
return obj return obj