diff --git a/rowers/models.py b/rowers/models.py
index b0d71fb0..93a1e9cd 100644
--- a/rowers/models.py
+++ b/rowers/models.py
@@ -1101,6 +1101,12 @@ class TrainingPlanForm(ModelForm):
targetchoices = [(x.id,x) for x in targets]
targetchoices.append((None,'---'))
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:
teams = Team.objects.filter(manager=self.instance.manager.user)
diff --git a/rowers/templates/trainingplan.html b/rowers/templates/trainingplan.html
index 1d29b18e..8e2e57d0 100644
--- a/rowers/templates/trainingplan.html
+++ b/rowers/templates/trainingplan.html
@@ -70,6 +70,13 @@
{{ macrocycle.0.name }} ({{ macrocycle.0.startdate }} - {{ macrocycle.0.enddate }})
+ {% if macrocycle.0.notes %}
+
+ |
+ {{ macrocycle.0.notes|linebreaks }}
+ |
+
+ {% endif %}
{% if macrocycle.0.type == 'userdefined' and macrocycle.0.plan.status %}
|
@@ -180,6 +187,13 @@
Meso {{ mesocycle.0.name }} ({{ mesocycle.0.startdate }} - {{ mesocycle.0.enddate }})
+ {% if mesocycle.0.notes %}
+
+ |
+ {{ mesocycle.0.notes|linebreaks }}
+ |
+
+ {% endif %}
{% if mesocycle.0.type == 'userdefined' and mesocycle.0.plan.plan.status %}
|
@@ -299,6 +313,13 @@
Micro {{ microcycle.name }} ({{ microcycle.startdate }} - {{ microcycle.enddate }})
+ {% if microcycle.notes %}
+
+ |
+ {{ microcycle.notes|linebreaks }}
+ |
+
+ {% endif %}
{% if microcycle.plan.plan.plan.status %}
|
diff --git a/rowers/views.py b/rowers/views.py
index 713869b9..f5077146 100644
--- a/rowers/views.py
+++ b/rowers/views.py
@@ -17011,6 +17011,8 @@ class TrainingPlanUpdate(UpdateView):
obj = super(TrainingPlanUpdate, self).get_object(*args, **kwargs)
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')
+ if obj.manager.rowerplan not in ['coach','plan']:
+ raise PermissionDenied('You are not allowed to edit this training plan')
return obj