fix
This commit is contained in:
@@ -1556,6 +1556,7 @@ class InstantPlan(models.Model):
|
||||
uuid = models.UUIDField(primary_key=False,editable=True,default=uuid.uuid4)
|
||||
owner = models.ForeignKey(User,on_delete=models.SET_NULL,null=True)
|
||||
name = models.CharField(max_length=150,blank=True)
|
||||
url = models.CharField(max_length=200,blank=True, verbose_name="URL Link to plan origin")
|
||||
goal = models.CharField(max_length=150,blank=True,verbose_name="Goal (one sentence)")
|
||||
description = models.TextField(max_length=450,blank=True)
|
||||
duration = models.IntegerField(default=6,verbose_name='Duration in Calendar Days')
|
||||
@@ -1596,6 +1597,7 @@ class InstantPlanForm(ModelForm):
|
||||
'target',
|
||||
'hoursperweek',
|
||||
'sessionsperweek',
|
||||
'url',
|
||||
'yaml',
|
||||
]
|
||||
|
||||
|
||||
@@ -11,6 +11,11 @@
|
||||
<ul class="main-content">
|
||||
<li class="grid_4">
|
||||
<p>Created by: {{ plan.owner.first_name }} {{ plan.owner.last_name }}</p>
|
||||
{% if plan.url %}
|
||||
<p>Link:
|
||||
<a href="{{ plan.url }}" target="_">{{ plan.url }}</a>
|
||||
</p>
|
||||
{% endif %}
|
||||
<p>Plan length: {{ plan.duration }} days</p>
|
||||
<p>{{ plan.description }}</p>
|
||||
<p>{{ plan.target }}</p>
|
||||
@@ -18,27 +23,37 @@
|
||||
<p>{{ plan.hoursperweek }} hours per week</p>
|
||||
<p>{{ plan.sessionsperweek }} sessions per week</p>
|
||||
</li>
|
||||
<li class="grid_2">
|
||||
<table width="100%" class="listtable">
|
||||
<li class="grid_4">
|
||||
<table width="100%" class="listtable shortpadded">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Week</th>
|
||||
<th>Day</th>
|
||||
<th>Workouts</th>
|
||||
<th>Day 1</th>
|
||||
<th>Day 2</th>
|
||||
<th>Day 3</th>
|
||||
<th>Day 4</th>
|
||||
<th>Day 5</th>
|
||||
<th>Day 6</th>
|
||||
<th>Day 7</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for day in trainingdays %}
|
||||
{% if day.order|weekbegin %}
|
||||
<tr>
|
||||
<td>{{ day.week }}</td>
|
||||
<td>{{ day.order }}</td>
|
||||
<td>
|
||||
<td width="5%">
|
||||
Week {{ day.week }}
|
||||
</td>
|
||||
{% endif %}
|
||||
<td width="14%">
|
||||
{% for workout in day.workouts %}
|
||||
<h3>{{ workout.workoutName }}</h3>
|
||||
{{ workout|steptostring|safe }}
|
||||
{% endfor %}
|
||||
</td>
|
||||
{% if day.order|weekend %}
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -128,6 +128,20 @@ def sex(s):
|
||||
|
||||
return u
|
||||
|
||||
@register.filter
|
||||
def weekbegin(nr):
|
||||
week, day = divmod(nr,7)
|
||||
if day == 1:
|
||||
return True
|
||||
return False
|
||||
|
||||
@register.filter
|
||||
def weekend(nr):
|
||||
week, day = divmod(nr,7)
|
||||
if day == 0:
|
||||
return True
|
||||
return False
|
||||
|
||||
@register.filter
|
||||
def weight(s):
|
||||
u = s
|
||||
|
||||
Reference in New Issue
Block a user