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