|
|
@@ -84,7 +84,6 @@ def welcome(request,utente=None):
|
|
|
|
|
|
ElencoDocumenti = list()
|
|
|
|
|
|
- '''
|
|
|
if utente: #visualizza i documenti per l'utente
|
|
|
ElencoDocumenti = Documento.objects.filter(utente=utente).order_by("utente__nome","documento")
|
|
|
elif sede:
|
|
|
@@ -100,12 +99,6 @@ def welcome(request,utente=None):
|
|
|
for id in d:
|
|
|
ElencoDocumenti.append(id)
|
|
|
|
|
|
- elencodocumentilista = len(ElencoDocumenti)
|
|
|
-
|
|
|
- # inizializzamo Paginator e il suo contatore
|
|
|
- ElencoDocumentiPage = Paginator(ElencoDocumenti,50)
|
|
|
- '''
|
|
|
-
|
|
|
if 'posizione' in request.session:
|
|
|
print('posizione presente in request.session')
|
|
|
posizione = request.session['posizione']
|
|
|
@@ -142,25 +135,22 @@ def welcome(request,utente=None):
|
|
|
return HttpResponseRedirect(reverse("azienda:welcome"))
|
|
|
|
|
|
if 'ScaricaSelezionati' in request.POST:
|
|
|
- print('Premuto tasto Scarica Selezionati')
|
|
|
- print('request.POST',request.POST)
|
|
|
-
|
|
|
- if 'MultipleDocumentSelect' in request.POST:
|
|
|
- print(len(data['ElencoDocumenti']))
|
|
|
- SelectResponse = formMultipleCheckBox(request.POST,lista=data['ElencoDocumenti'])
|
|
|
- print("SelectResponse",SelectResponse)
|
|
|
-
|
|
|
- if SelectResponse.is_valid():
|
|
|
- select = SelectResponse.cleaned_data.get('MultipleDocumentSelect')
|
|
|
- print('select',select,type(select))
|
|
|
- (pathzipfile,filePreparato) = PrepareZipFile(select)
|
|
|
- # scarica il file
|
|
|
- response = None
|
|
|
- with open(os.path.join(pathzipfile,filePreparato),'rb') as f:
|
|
|
- response = HttpResponse(f.read(),content_type='application/zip')
|
|
|
- response['Content-Disposition'] = 'attachment; filename={}'.format(filePreparato)
|
|
|
- os.unlink(os.path.join(pathzipfile,filePreparato))
|
|
|
- return response
|
|
|
+ print('Premuto tasto Scarica Selezionati',request.POST)
|
|
|
+ print(ElencoDocumenti)
|
|
|
+ SelectResponse = formMultipleCheckBox(request.POST,lista=ElencoDocumenti)
|
|
|
+ print(SelectResponse)
|
|
|
+
|
|
|
+ if SelectResponse.is_valid():
|
|
|
+ select = SelectResponse.cleaned_data.get('MultipleDocumentSelect')
|
|
|
+ print('select',select,type(select))
|
|
|
+ (pathzipfile,filePreparato) = PrepareZipFile(select)
|
|
|
+ # scarica il file
|
|
|
+ response = None
|
|
|
+ with open(os.path.join(pathzipfile,filePreparato),'rb') as f:
|
|
|
+ response = HttpResponse(f.read(),content_type='application/zip')
|
|
|
+ response['Content-Disposition'] = 'attachment; filename={}'.format(filePreparato)
|
|
|
+ os.unlink(os.path.join(pathzipfile,filePreparato))
|
|
|
+ return response
|
|
|
|
|
|
if 'DeleteOldDocuments' in request.POST:
|
|
|
print('Richiesta di eliminazione vecchi documenti')
|
|
|
@@ -621,23 +611,21 @@ def azienda(request,utente=None):
|
|
|
|
|
|
if 'ScaricaSelezionati' in request.POST:
|
|
|
print('Premuto tasto Scarica Selezionati,cazzo')
|
|
|
- print('request.POST',request.POST)
|
|
|
+ print('xx request.POST',request.POST)
|
|
|
|
|
|
- if 'MultipleDocumentSelect' in request.POST:
|
|
|
- SelectResponse = formMultipleCheckBox(request.POST,lista=data['ElencoDocumenti'])
|
|
|
- print("SelectResponse",SelectResponse)
|
|
|
+ SelectResponse = formMultipleCheckBox(request.POST,lista=data['ElencoDocumenti'])
|
|
|
|
|
|
- if SelectResponse.is_valid():
|
|
|
- select = SelectResponse.cleaned_data.get('MultipleDocumentSelect')
|
|
|
- print('select',select,type(select))
|
|
|
- (pathzipfile,filePreparato) = PrepareZipFile(select)
|
|
|
- # scarica il file
|
|
|
- response = None
|
|
|
- with open(os.path.join(pathzipfile,filePreparato),'rb') as f:
|
|
|
- response = HttpResponse(f.read(),content_type='application/zip')
|
|
|
- response['Content-Disposition'] = 'attachment; filename={}'.format(filePreparato)
|
|
|
- os.unlink(os.path.join(pathzipfile,filePreparato))
|
|
|
- return response
|
|
|
+ if SelectResponse.is_valid():
|
|
|
+ select = SelectResponse.cleaned_data.get('MultipleDocumentSelect')
|
|
|
+ print('select',select,type(select))
|
|
|
+ (pathzipfile,filePreparato) = PrepareZipFile(select)
|
|
|
+ # scarica il file
|
|
|
+ response = None
|
|
|
+ with open(os.path.join(pathzipfile,filePreparato),'rb') as f:
|
|
|
+ response = HttpResponse(f.read(),content_type='application/zip')
|
|
|
+ response['Content-Disposition'] = 'attachment; filename={}'.format(filePreparato)
|
|
|
+ os.unlink(os.path.join(pathzipfile,filePreparato))
|
|
|
+ return response
|
|
|
|
|
|
if 'DeleteOldDocuments' in request.POST:
|
|
|
print('Richiesta di eliminazione vecchi documenti')
|