|
|
@@ -30,6 +30,7 @@ def welcome(request):
|
|
|
data['AziendaId'] = request.session['AziendaId']
|
|
|
data['azienda'] = Azienda.objects.get(pk=data['AziendaId'])
|
|
|
data['utenti'] = data['azienda'].utente_set.all().order_by('nome')
|
|
|
+ data['numeroRecordAzienda'] = len(data['utenti'])
|
|
|
|
|
|
if 'AdminId' in request.session:
|
|
|
data['AdminId'] = request.session['AdminId']
|
|
|
@@ -42,15 +43,16 @@ def welcome(request):
|
|
|
data['SedeId'] = request.session['SedeId']
|
|
|
data['sede'] = Sede.objects.get(pk=request.session['SedeId'])
|
|
|
data['utenti'] = data['sede'].utente_set.all().order_by('nome')
|
|
|
+ else:
|
|
|
+ data['sede'] = None
|
|
|
|
|
|
if 'UserId' in request.session:
|
|
|
data['UserId'] = request.session['UserId']
|
|
|
|
|
|
+ data['numeroRecordAttuali'] = len(data['utenti'])
|
|
|
+
|
|
|
if request.method == 'POST':
|
|
|
print('qualcuno ha premuto un tasto')
|
|
|
- if "CaricamentiMultipli" in request.POST:
|
|
|
- print("Richiesto Caricamento Documenti")
|
|
|
- return HttpResponseRedirect(reverse("documento:welcome"))
|
|
|
|
|
|
if 'indietro' in request.POST:
|
|
|
return HttpResponseRedirect(reverse("azienda:welcome"))
|
|
|
@@ -61,23 +63,21 @@ def welcome(request):
|
|
|
request.session['UserEditId'] = scelta
|
|
|
print('scelta effettuata',scelta)
|
|
|
return HttpResponseRedirect(reverse("utente:edit"))
|
|
|
-
|
|
|
- filecaricati = AdminUpload(request.POST,request.FILES)
|
|
|
-
|
|
|
- if filecaricati.is_valid():
|
|
|
- print('record filecaricati validi')
|
|
|
- if filecaricati.cleaned_data.get('indice'):
|
|
|
- print('presente file indice')
|
|
|
- fileindice = filecaricati.cleaned_data.get('indice')
|
|
|
- print(fileindice)
|
|
|
- save_and_load_file_indice(fileindice,request,data['AziendaId'])
|
|
|
- if filecaricati.cleaned_data.get('allegati'):
|
|
|
- print('presenti documenti da allegare')
|
|
|
- listadocumenti = filecaricati.cleaned_data['allegati']
|
|
|
- print(listadocumenti)
|
|
|
- listaok,listanotok = save_and_load_file_multiple(listadocumenti,request,data['utenti'],data['AziendaId'],data['SedeId'],filecaricati.cleaned_data['descrizione'],data['admin'])
|
|
|
- data['listaok'] = listaok
|
|
|
- data['listanotok'] = listanotok
|
|
|
+
|
|
|
+ if data['admin'].crea_utente:
|
|
|
+ if 'CaricaIndice' in request.POST:
|
|
|
+ print('request',request.POST)
|
|
|
+ print('files',request.FILES)
|
|
|
+ fileindicecaricato = formIndiceUpload(request.POST,request.FILES)
|
|
|
+ print(fileindicecaricato)
|
|
|
+ if fileindicecaricato.is_valid():
|
|
|
+ print('record filecaricati validi')
|
|
|
+ print('presente file indice')
|
|
|
+ fileindiceottenuto = fileindicecaricato.cleaned_data.get('indice')
|
|
|
+ save_and_load_file_indice(request,fileindiceottenuto,data['azienda'],data['sede'])
|
|
|
+ else:
|
|
|
+ print('request non valida')
|
|
|
+
|
|
|
return render(request,'utente.welcome.html',data)
|
|
|
|
|
|
def edit(request):
|