remember form
This commit is contained in:
@@ -135,6 +135,7 @@ def analysis_new(request,
|
|||||||
|
|
||||||
chartform = AnalysisChoiceForm(request.POST)
|
chartform = AnalysisChoiceForm(request.POST)
|
||||||
if chartform.is_valid():
|
if chartform.is_valid():
|
||||||
|
options['form'] = chartform.cleaned_data
|
||||||
for key, value in chartform.cleaned_data.items():
|
for key, value in chartform.cleaned_data.items():
|
||||||
options[key] = value
|
options[key] = value
|
||||||
|
|
||||||
@@ -237,6 +238,11 @@ def analysis_new(request,
|
|||||||
if id:
|
if id:
|
||||||
form.fields["workouts"].initial = [firstworkout]
|
form.fields["workouts"].initial = [firstworkout]
|
||||||
chartform = AnalysisChoiceForm(initial={'function': function})
|
chartform = AnalysisChoiceForm(initial={'function': function})
|
||||||
|
try:
|
||||||
|
chartformoptions = options['form']
|
||||||
|
chartform = AnalysisChoiceForm(initial=chartformoptions)
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
selectedworkouts = Workout.objects.none()
|
selectedworkouts = Workout.objects.none()
|
||||||
else:
|
else:
|
||||||
selectedworkouts = Workout.objects.filter(id__in=ids)
|
selectedworkouts = Workout.objects.filter(id__in=ids)
|
||||||
@@ -1982,8 +1988,6 @@ class SavedAnalysisView(UserPassesTestMixin, View):
|
|||||||
request.session['analyses'] = [a.id for a in self.selected]
|
request.session['analyses'] = [a.id for a in self.selected]
|
||||||
# now should redirect to analysis
|
# now should redirect to analysis
|
||||||
self.script, self.div = self.chart(self.selected)
|
self.script, self.div = self.chart(self.selected)
|
||||||
else:
|
|
||||||
print(form.errors)
|
|
||||||
|
|
||||||
return render(request, self.template_name,
|
return render(request, self.template_name,
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user