8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-24 20:33:11 +00:00

[Printer] Fix major bug. See below for more explanations :

Before, I used request.session to store some information about the current jobs to be printed.
This was because in the very beginning, I had an issue with disappearing files in my model.

I was able to fix this issue in a previous commit, but I still needed the jids.
However, because of this storage system, if someone tried to print a file, then oppened a second tab,
and tried to print anoter file, he/she would pay twice for the second file ....

I decided to add a hidden field to store the job id and deal with it, and it is readonly to avoid
changing it.
This commit is contained in:
Maxime Bombar 2018-10-21 19:48:10 +02:00 committed by root
parent bca63818ac
commit 663ade9765

View file

@ -59,8 +59,6 @@ def new_job(request):
form_kwargs={'user': request.user},
)
if job_formset.is_valid():
data = []
i=0
@ -86,7 +84,9 @@ def new_job(request):
i+=1
job_formset_filled_in = formset_factory(PrintForm, extra=0)(
initial=data,
form_kwargs={'user': request.user},
# jids=jids,
form_kwargs={'user': request.user,
},
)
if job_formset.total_error_count() == 0:
@ -150,6 +150,7 @@ def new_job(request):
### GET request
else:
# raise Exception("Coucou2")
job_formset = formset_factory(JobWithOptionsForm)(
form_kwargs={'user': request.user}
)