adding plan and target edit
This commit is contained in:
@@ -840,6 +840,7 @@ def checkworkoutuser(user,workout):
|
||||
except Rower.DoesNotExist:
|
||||
return False
|
||||
|
||||
|
||||
# Check if user is coach or rower
|
||||
def checkaccessuser(user,rower):
|
||||
try:
|
||||
@@ -1008,7 +1009,7 @@ class TrainingPlan(models.Model):
|
||||
self.startdate = enddate
|
||||
self.enddate = startdate
|
||||
|
||||
otherplans = TrainingPlan.objects.filter(rower=self.rower)
|
||||
otherplans = TrainingPlan.objects.filter(rower=self.rower).exclude(pk=self.pk)
|
||||
|
||||
for otherplan in otherplans:
|
||||
if otherplan.startdate <= self.enddate and otherplan.startdate >= self.startdate:
|
||||
@@ -1016,8 +1017,6 @@ class TrainingPlan(models.Model):
|
||||
if otherplan.enddate >= self.startdate and otherplan.enddate <= self.enddate:
|
||||
self.startdate = otherplan.enddate+datetime.timedelta(days=1)
|
||||
|
||||
print self.startdate,self.enddate
|
||||
|
||||
if not self.enddate <= self.startdate:
|
||||
super(TrainingPlan,self).save(*args, **kwargs)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user