fix bug
This commit is contained in:
@@ -2524,14 +2524,18 @@ def rower_view_instantplan(request,id='',userid=0):
|
|||||||
'id':id,
|
'id':id,
|
||||||
})
|
})
|
||||||
return HttpResponseRedirect(url)
|
return HttpResponseRedirect(url)
|
||||||
form = InstantPlanSelectForm(request.POST)
|
form = InstantPlanSelectForm(request.POST,targets=targets)
|
||||||
|
|
||||||
|
|
||||||
if form.is_valid():
|
if form.is_valid():
|
||||||
plansteps = response.json()
|
plansteps = response.json()
|
||||||
name = form.cleaned_data['name']
|
name = form.cleaned_data['name']
|
||||||
try:
|
try:
|
||||||
target = form.cleaned_data['target']
|
targetid = form.cleaned_data['target']
|
||||||
|
if targetid != '':
|
||||||
|
target = TrainingTarget.objects.get(id=int(targetid))
|
||||||
|
else:
|
||||||
|
target = None
|
||||||
except KeyError:
|
except KeyError:
|
||||||
try:
|
try:
|
||||||
targetid = request.POST['target']
|
targetid = request.POST['target']
|
||||||
@@ -2546,8 +2550,10 @@ def rower_view_instantplan(request,id='',userid=0):
|
|||||||
notes = form.cleaned_data['notes']
|
notes = form.cleaned_data['notes']
|
||||||
datechoice = form.cleaned_data['datechoice']
|
datechoice = form.cleaned_data['datechoice']
|
||||||
status = True
|
status = True
|
||||||
|
|
||||||
if target and datechoice == 'target':
|
if target and datechoice == 'target':
|
||||||
enddate = target.date
|
enddate = target.date
|
||||||
|
startdate = enddate-datetime.timedelta(days=plan.duration)
|
||||||
elif datechoice == 'startdate':
|
elif datechoice == 'startdate':
|
||||||
enddate = startdate+datetime.timedelta(days=plan.duration)
|
enddate = startdate+datetime.timedelta(days=plan.duration)
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user