|
|
@@ -263,6 +263,29 @@ def edit(request):
|
|
|
return HttpResponseRedirect(reverse("utente:welcome"))
|
|
|
print('request.method x edit utente')
|
|
|
|
|
|
+ if 'SetPrivateDocument' in request.POST and request.POST.get('SetPrivateDocument'):
|
|
|
+ print('Richiesta setPrivate',request.POST)
|
|
|
+ documento = request.POST['SetPrivateDocument'] # perche' lo considera una lista e non un singolo valore?
|
|
|
+ print('richiesta SetPrivateDocument documento:',documento)
|
|
|
+
|
|
|
+ try:
|
|
|
+ d = Documento.objects.get(pk=documento)
|
|
|
+ d.privato = True
|
|
|
+ d.save()
|
|
|
+ except Documento.DoesNotExist as dne:
|
|
|
+ print('il documento non esiste')
|
|
|
+
|
|
|
+ if 'UnsetPrivateDocument' in request.POST and request.POST.get('UnsetPrivateDocument'):
|
|
|
+ print('Richiesta UnsetPrivate',request.POST)
|
|
|
+ documento = request.POST['UnsetPrivateDocument'] # perche' lo considera una lista e non un singolo valore?
|
|
|
+ print('richiesta UnsetPrivateDocument documento:',documento)
|
|
|
+ try:
|
|
|
+ d = Documento.objects.get(pk=documento)
|
|
|
+ d.privato = False
|
|
|
+ d.save()
|
|
|
+ except Documento.DoesNotExist as dne:
|
|
|
+ print('il documento non esiste')
|
|
|
+
|
|
|
if 'DeleteDocument' in request.POST:
|
|
|
documento = request.POST['DeleteDocument']
|
|
|
print('documento da rimuovere',documento)
|