mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-28 15:42:25 +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:
parent
bca63818ac
commit
663ade9765
1 changed files with 4 additions and 3 deletions
|
@ -59,8 +59,6 @@ def new_job(request):
|
||||||
form_kwargs={'user': request.user},
|
form_kwargs={'user': request.user},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if job_formset.is_valid():
|
if job_formset.is_valid():
|
||||||
data = []
|
data = []
|
||||||
i=0
|
i=0
|
||||||
|
@ -86,7 +84,9 @@ def new_job(request):
|
||||||
i+=1
|
i+=1
|
||||||
job_formset_filled_in = formset_factory(PrintForm, extra=0)(
|
job_formset_filled_in = formset_factory(PrintForm, extra=0)(
|
||||||
initial=data,
|
initial=data,
|
||||||
form_kwargs={'user': request.user},
|
# jids=jids,
|
||||||
|
form_kwargs={'user': request.user,
|
||||||
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
if job_formset.total_error_count() == 0:
|
if job_formset.total_error_count() == 0:
|
||||||
|
@ -150,6 +150,7 @@ def new_job(request):
|
||||||
|
|
||||||
### GET request
|
### GET request
|
||||||
else:
|
else:
|
||||||
|
# raise Exception("Coucou2")
|
||||||
job_formset = formset_factory(JobWithOptionsForm)(
|
job_formset = formset_factory(JobWithOptionsForm)(
|
||||||
form_kwargs={'user': request.user}
|
form_kwargs={'user': request.user}
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue