8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-09 19:36:27 +00:00

[Printer] Prevent crashing when no file is given

This commit is contained in:
Maxime Bombar 2018-10-20 02:27:12 +02:00 committed by root
parent 3a3f2e0797
commit 62aef50c08

View file

@ -46,15 +46,16 @@ def new_job(request):
View to create a new printing job View to create a new printing job
""" """
if request.method == 'POST': if request.method == 'POST':
if request.FILES:
job_formset = formset_factory(JobWithOptionsForm)( job_formset = formset_factory(JobWithOptionsForm)(
request.POST, request.POST,
request.FILES, request.FILES or None,
form_kwargs={'user': request.user}, form_kwargs={'user': request.user},
) )
tmp_job_formset = job_formset tmp_job_formset = job_formset
if request.FILES:
if job_formset.is_valid(): if job_formset.is_valid():
files = request.FILES files = request.FILES
data = [] data = []