bug fix
This commit is contained in:
@@ -127,9 +127,9 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="4">
|
<td colspan="4">
|
||||||
<a href="/rowers/microcycle/{{ mesocycle.0.id }}">edit</a>
|
<a href="/rowers/mesocycle/{{ mesocycle.0.id }}">edit</a>
|
||||||
/
|
/
|
||||||
<a href="/rowers/deletemicrocycle/{{ mesocycle.0.id }}">delete</a>
|
<a href="/rowers/deletemesocycle/{{ mesocycle.0.id }}">delete</a>
|
||||||
/
|
/
|
||||||
<a href='/rowers/sessions/{{ mesocycle.0.startdate|date:"Y-m-d" }}/{{ mesocycle.0.enddate|date:"Y-m-d" }}'>sessions</a>
|
<a href='/rowers/sessions/{{ mesocycle.0.startdate|date:"Y-m-d" }}/{{ mesocycle.0.enddate|date:"Y-m-d" }}'>sessions</a>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@@ -14417,7 +14417,7 @@ class TrainingPlanDelete(DeleteView):
|
|||||||
def get_object(self, *args, **kwargs):
|
def get_object(self, *args, **kwargs):
|
||||||
obj = super(TrainingPlanDelete, self).get_object(*args, **kwargs)
|
obj = super(TrainingPlanDelete, self).get_object(*args, **kwargs)
|
||||||
if not checkaccessuser(self.request.user,obj.plan.rower):
|
if not checkaccessuser(self.request.user,obj.plan.rower):
|
||||||
raise Http404
|
raise PermissionDenied('You are not allowed to delete this training plan')
|
||||||
|
|
||||||
return obj
|
return obj
|
||||||
|
|
||||||
@@ -14436,8 +14436,7 @@ class MicroCycleDelete(DeleteView):
|
|||||||
def get_object(self, *args, **kwargs):
|
def get_object(self, *args, **kwargs):
|
||||||
obj = super(MicroCycleDelete, self).get_object(*args, **kwargs)
|
obj = super(MicroCycleDelete, self).get_object(*args, **kwargs)
|
||||||
if not checkaccessuser(self.request.user,obj.plan.plan.plan.rower):
|
if not checkaccessuser(self.request.user,obj.plan.plan.plan.rower):
|
||||||
raise Http404
|
raise PermissionDenied('You are not allowed to delete this training plan cycle')
|
||||||
|
|
||||||
return obj
|
return obj
|
||||||
|
|
||||||
|
|
||||||
@@ -14456,7 +14455,7 @@ class MesoCycleDelete(DeleteView):
|
|||||||
def get_object(self, *args, **kwargs):
|
def get_object(self, *args, **kwargs):
|
||||||
obj = super(MesoCycleDelete, self).get_object(*args, **kwargs)
|
obj = super(MesoCycleDelete, self).get_object(*args, **kwargs)
|
||||||
if not checkaccessuser(self.request.user,obj.plan.plan.rower):
|
if not checkaccessuser(self.request.user,obj.plan.plan.rower):
|
||||||
raise Http404
|
raise PermissionDenied('You are not allowed to delete this training plan cycle')
|
||||||
|
|
||||||
return obj
|
return obj
|
||||||
|
|
||||||
@@ -14476,7 +14475,7 @@ class MacroCycleDelete(DeleteView):
|
|||||||
def get_object(self, *args, **kwargs):
|
def get_object(self, *args, **kwargs):
|
||||||
obj = super(MacroCycleDelete, self).get_object(*args, **kwargs)
|
obj = super(MacroCycleDelete, self).get_object(*args, **kwargs)
|
||||||
if not checkaccessuser(self.request.user,obj.plan.rower):
|
if not checkaccessuser(self.request.user,obj.plan.rower):
|
||||||
raise Http404
|
raise PermissionDenied('You are not allowed to delete this training plan cycle')
|
||||||
|
|
||||||
return obj
|
return obj
|
||||||
|
|
||||||
@@ -14496,8 +14495,6 @@ def rower_trainingplan_view(request,id=0):
|
|||||||
createmacrofillers(plan)
|
createmacrofillers(plan)
|
||||||
macrocycles = TrainingMacroCycle.objects.filter(plan=plan).order_by("startdate")
|
macrocycles = TrainingMacroCycle.objects.filter(plan=plan).order_by("startdate")
|
||||||
|
|
||||||
count = 0
|
|
||||||
cycles = {}
|
|
||||||
|
|
||||||
r = plan.rower
|
r = plan.rower
|
||||||
|
|
||||||
@@ -14514,8 +14511,7 @@ def rower_trainingplan_view(request,id=0):
|
|||||||
|
|
||||||
|
|
||||||
mesocycles = TrainingMesoCycle.objects.filter(plan=m).order_by("startdate")
|
mesocycles = TrainingMesoCycle.objects.filter(plan=m).order_by("startdate")
|
||||||
mesos = {}
|
|
||||||
count2 = 0
|
|
||||||
for me in mesocycles:
|
for me in mesocycles:
|
||||||
createmicrofillers(me)
|
createmicrofillers(me)
|
||||||
me.plantime = 0
|
me.plantime = 0
|
||||||
@@ -14586,11 +14582,30 @@ def rower_trainingplan_view(request,id=0):
|
|||||||
m.actualtrimp += me.actualtrimp
|
m.actualtrimp += me.actualtrimp
|
||||||
|
|
||||||
|
|
||||||
mesos[count2] = (me, microcycles)
|
|
||||||
count2 += 1
|
|
||||||
|
|
||||||
if m.type == 'userdefined':
|
if m.type == 'userdefined':
|
||||||
m.save()
|
m.save()
|
||||||
|
|
||||||
|
createmacrofillers(plan)
|
||||||
|
macrocycles = TrainingMacroCycle.objects.filter(plan=plan).order_by("startdate")
|
||||||
|
|
||||||
|
count = 0
|
||||||
|
cycles = {}
|
||||||
|
|
||||||
|
r = plan.rower
|
||||||
|
|
||||||
|
for m in macrocycles:
|
||||||
|
createmesofillers(m)
|
||||||
|
mesocycles = TrainingMesoCycle.objects.filter(plan=m).order_by("startdate")
|
||||||
|
mesos = {}
|
||||||
|
count2 = 0
|
||||||
|
for me in mesocycles:
|
||||||
|
createmicrofillers(me)
|
||||||
|
microcycles = TrainingMicroCycle.objects.filter(plan=me).order_by("startdate")
|
||||||
|
|
||||||
|
mesos[count2] = (me, microcycles)
|
||||||
|
count2 += 1
|
||||||
|
|
||||||
cycles[count] = (m,mesos)
|
cycles[count] = (m,mesos)
|
||||||
count += 1
|
count += 1
|
||||||
|
|
||||||
@@ -14627,7 +14642,7 @@ class TrainingMacroCycleUpdate(UpdateView):
|
|||||||
def get_object(self, *args, **kwargs):
|
def get_object(self, *args, **kwargs):
|
||||||
obj = super(TrainingMacroCycleUpdate, self).get_object(*args, **kwargs)
|
obj = super(TrainingMacroCycleUpdate, self).get_object(*args, **kwargs)
|
||||||
if not checkaccessuser(self.request.user,obj.plan.rower):
|
if not checkaccessuser(self.request.user,obj.plan.rower):
|
||||||
raise Http404
|
raise PermissionDenied('You are not allowed to edit this training plan cycle')
|
||||||
else:
|
else:
|
||||||
obj.type = 'userdefined'
|
obj.type = 'userdefined'
|
||||||
obj.save()
|
obj.save()
|
||||||
@@ -14659,7 +14674,7 @@ class TrainingMesoCycleUpdate(UpdateView):
|
|||||||
obj = super(TrainingMesoCycleUpdate, self).get_object(*args, **kwargs)
|
obj = super(TrainingMesoCycleUpdate, self).get_object(*args, **kwargs)
|
||||||
r = obj.plan.plan.rower
|
r = obj.plan.plan.rower
|
||||||
if not checkaccessuser(self.request.user,r):
|
if not checkaccessuser(self.request.user,r):
|
||||||
raise Http404
|
raise PermissionDenied('You are not allowed to edit this training plan cycle')
|
||||||
else:
|
else:
|
||||||
obj.type = 'userdefined'
|
obj.type = 'userdefined'
|
||||||
obj.save()
|
obj.save()
|
||||||
@@ -14692,7 +14707,7 @@ class TrainingMicroCycleUpdate(UpdateView):
|
|||||||
obj = super(TrainingMicroCycleUpdate, self).get_object(*args, **kwargs)
|
obj = super(TrainingMicroCycleUpdate, self).get_object(*args, **kwargs)
|
||||||
r = obj.plan.plan.plan.rower
|
r = obj.plan.plan.plan.rower
|
||||||
if not checkaccessuser(self.request.user,r):
|
if not checkaccessuser(self.request.user,r):
|
||||||
raise Http404
|
raise PermissionDenied('You are not allowed to edit this training plan cycle')
|
||||||
else:
|
else:
|
||||||
obj.type = 'userdefined'
|
obj.type = 'userdefined'
|
||||||
obj.save()
|
obj.save()
|
||||||
@@ -14718,7 +14733,7 @@ class TrainingPlanUpdate(UpdateView):
|
|||||||
def get_object(self, *args, **kwargs):
|
def get_object(self, *args, **kwargs):
|
||||||
obj = super(TrainingPlanUpdate, self).get_object(*args, **kwargs)
|
obj = super(TrainingPlanUpdate, self).get_object(*args, **kwargs)
|
||||||
if not checkaccessuser(self.request.user,obj.rower):
|
if not checkaccessuser(self.request.user,obj.rower):
|
||||||
raise Http404
|
raise PermissionDenied('You are not allowed to edit this training plan cycle')
|
||||||
return obj
|
return obj
|
||||||
|
|
||||||
class TrainingTargetUpdate(UpdateView):
|
class TrainingTargetUpdate(UpdateView):
|
||||||
@@ -14738,6 +14753,6 @@ class TrainingTargetUpdate(UpdateView):
|
|||||||
def get_object(self, *args, **kwargs):
|
def get_object(self, *args, **kwargs):
|
||||||
obj = super(TrainingTargetUpdate, self).get_object(*args, **kwargs)
|
obj = super(TrainingTargetUpdate, self).get_object(*args, **kwargs)
|
||||||
if not checkaccessuser(self.request.user,obj.rower):
|
if not checkaccessuser(self.request.user,obj.rower):
|
||||||
raise Http404
|
raise PermissionDenied('You are not allowed to edit this training plan target')
|
||||||
return obj
|
return obj
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user