Adding a notes field to the training plan
This commit is contained in:
@@ -1398,6 +1398,7 @@ class TrainingPlan(models.Model):
|
||||
status = models.BooleanField(default=True,verbose_name='Active')
|
||||
target = models.ForeignKey(TrainingTarget,blank=True,null=True,on_delete=models.SET_NULL)
|
||||
startdate = models.DateField(default=current_day)
|
||||
notes = models.CharField(blank=True,null=True,max_length=200,verbose_name='Plan Notes')
|
||||
enddate = models.DateField(
|
||||
default=half_year_from_now)
|
||||
|
||||
@@ -1476,11 +1477,12 @@ class TrainingPlan(models.Model):
|
||||
class TrainingPlanForm(ModelForm):
|
||||
class Meta:
|
||||
model = TrainingPlan
|
||||
fields = ['name','target','startdate','enddate','status','rowers']
|
||||
fields = ['name','target','startdate','enddate','status','notes','rowers']
|
||||
|
||||
widgets = {
|
||||
'startdate': AdminDateWidget(),
|
||||
'enddate': AdminDateWidget()
|
||||
'enddate': AdminDateWidget(),
|
||||
'notes': forms.Textarea()
|
||||
}
|
||||
|
||||
def __init__(self,*args, **kwargs):
|
||||
|
||||
@@ -24,6 +24,11 @@
|
||||
The training plan target is: {{ plan.target.name }} on {{ plan.target.date }}.
|
||||
{% endif %}
|
||||
</p>
|
||||
|
||||
<h2>Notes</h2>
|
||||
<p>
|
||||
{{ plan.notes }}
|
||||
</p>
|
||||
{% if plan|mayeditplan:request %}
|
||||
<p><a href="/rowers/editplan/{{ plan.id }}">Edit the plan</a></p>
|
||||
{% endif %}
|
||||
@@ -303,7 +308,7 @@
|
||||
</th>
|
||||
</tr>
|
||||
{% if todays_date <= microcycle.enddate %}
|
||||
{% if microcycle.plan.type == 'userdefined' %}
|
||||
{% if microcycle.plan.type == 'userdefined' %}
|
||||
<tr>
|
||||
<td> </td>
|
||||
</tr>
|
||||
@@ -381,7 +386,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="4">
|
||||
{% if microcycle|mayeditplan:request %}
|
||||
{% if microcycle|mayeditplan:request %}
|
||||
<a href="/rowers/microcycle/{{ microcycle.id }}">edit</a>
|
||||
/
|
||||
<a href="/rowers/deletemicrocycle/{{ microcycle.id }}">delete</a>
|
||||
@@ -427,7 +432,7 @@
|
||||
The gray "filler"
|
||||
cycles are generated, adjusted and deleted automatically to
|
||||
ensure the entire plan
|
||||
duration is covered with non-overlapping cycles.
|
||||
duration is covered with non-overlapping cycles.
|
||||
Once you edit a filler cycle, it become a user-defined
|
||||
cycle, which cannot be deleted
|
||||
by the system.</p>
|
||||
|
||||
@@ -1557,7 +1557,7 @@ def plannedsession_totemplate_view(request,id=0):
|
||||
ps.enddate = datetime.date(1970,1,1)
|
||||
ps.save()
|
||||
|
||||
url = reverse(plannedsession_create_view,kwargs={'userid':request.user.id})
|
||||
url = reverse(plannedsession_create_view,kwargs={'userid':r.user.id})
|
||||
|
||||
startdatestring = startdate.strftime('%Y-%m-%d')
|
||||
enddatestring = enddate.strftime('%Y-%m-%d')
|
||||
@@ -2021,6 +2021,7 @@ def rower_create_trainingplan(request,userid=0):
|
||||
startdate = form.cleaned_data['startdate']
|
||||
status = form.cleaned_data['status']
|
||||
enddate = form.cleaned_data['enddate']
|
||||
notes = form.cleaned_data['notes']
|
||||
|
||||
try:
|
||||
athletes = form.cleaned_data['rowers']
|
||||
@@ -2033,6 +2034,7 @@ def rower_create_trainingplan(request,userid=0):
|
||||
manager=themanager,
|
||||
startdate=startdate,
|
||||
enddate=enddate,status=status,
|
||||
notes=notes,
|
||||
)
|
||||
|
||||
p.save()
|
||||
|
||||
Reference in New Issue
Block a user