making upload options sticky and adding make private
This commit is contained in:
@@ -4181,7 +4181,26 @@ def workout_getc2workout_view(request,c2id):
|
||||
return HttpResponseRedirect(url)
|
||||
|
||||
# This is the main view for processing uploaded files
|
||||
@login_required()
|
||||
@login_required()
|
||||
def workout_upload_view(request,message="",
|
||||
uploadoptions={
|
||||
'makeprivate':False,
|
||||
'make_plot':False,
|
||||
'upload_to_C2':False,
|
||||
'plottype':'timeplot',
|
||||
}):
|
||||
|
||||
if 'uploadoptions' in request.session:
|
||||
uploadoptions = request.session['uploadoptions']
|
||||
else:
|
||||
request.session['uploadoptions'] = uploadoptions
|
||||
|
||||
|
||||
|
||||
makeprivate = uploadoptions['makeprivate']
|
||||
make_plot = uploadoptions['make_plot']
|
||||
plottype = uploadoptions['plottype']
|
||||
upload_toc2 = uploadoptions['upload_to_C2']
|
||||
|
||||
r = Rower.objects.get(user=request.user)
|
||||
if request.method == 'POST':
|
||||
@@ -4193,10 +4212,22 @@ def workout_upload_view(request,message=""):
|
||||
t = form.cleaned_data['title']
|
||||
workouttype = form.cleaned_data['workouttype']
|
||||
|
||||
notes = form.cleaned_data['notes']
|
||||
make_plot = request.POST.getlist('make_plot')
|
||||
plottype = request.POST['plottype']
|
||||
notes = form.cleaned_data['notes']
|
||||
|
||||
if optionsform.is_valid():
|
||||
make_plot = optionsform.cleaned_data['make_plot']
|
||||
plottype = optionsform.cleaned_data['plottype']
|
||||
upload_to_c2 = optionsform.cleaned_data['upload_to_C2']
|
||||
makeprivate = optionsform.cleaned_data['makeprivate']
|
||||
|
||||
uploadoptions = {
|
||||
'makeprivate':makeprivate,
|
||||
'make_plot':make_plot,
|
||||
'plottype':plottype,
|
||||
'upload_to_C2':upload_to_c2,
|
||||
}
|
||||
|
||||
|
||||
request.session['uploadoptions'] = uploadoptions
|
||||
|
||||
f1 = res[0] # file name
|
||||
@@ -4204,6 +4235,7 @@ def workout_upload_view(request,message=""):
|
||||
|
||||
|
||||
id,message = dataprep.new_workout_from_file(r,f2,
|
||||
workouttype=workouttype,
|
||||
makeprivate=makeprivate,
|
||||
title = t,
|
||||
notes='')
|
||||
@@ -4344,7 +4376,7 @@ def workout_upload_view(request,message=""):
|
||||
|
||||
return response
|
||||
else:
|
||||
form = DocumentsForm()
|
||||
form = DocumentsForm()
|
||||
optionsform = UploadOptionsForm(initial=uploadoptions)
|
||||
return render(request, 'document_form.html',
|
||||
{'form':form,
|
||||
|
||||
Reference in New Issue
Block a user