Explorar o código

Changes to be committed:
deleted: utente/forms.py~
new file: utente/templates/utente.edit.document.html
modified: utente/templates/utente.edit.html
new file: utente/templates/utente.edit.logger.html
new file: utente/templates/utente.edit.profile.html
deleted: utente/templates/utente.welcome.html.old
deleted: utente/views.py~
Changes not staged for commit:
deleted: utente/templates/utente.edit.html~
deleted: utente/templates/utente.welcome.html~
Untracked files:
att/migrations/0010_alter_attivita_data.py
config/migrations/0003_config_nota_alter_config_valore.py

Mauro hai 1 ano
pai
achega
68a6094835

+ 0 - 34
utente/forms.py~

@@ -1,34 +0,0 @@
-from django import  forms
-
-class MultipleFileInput(forms.ClearableFileInput):
-    allow_multiple_selected = True
-
-class MultipleFileField(forms.FileField):
-    def __init__(self, *args, **kwargs):
-        kwargs.setdefault("widget", MultipleFileInput())
-        super().__init__(*args, **kwargs)
-
-    def clean(self, data, initial=None):
-        single_file_clean = super().clean
-        if isinstance(data, (list, tuple)):
-            result = [single_file_clean(d, initial) for d in data]
-        else:
-            result = [single_file_clean(data, initial)]
-        return result
-
-class AdminUpload(forms.Form):
-  def __init__(self,*args,**kwargs):
-    forms.Form.__init__(self,*args,**kwargs)
-    self.fields['indice'] = forms.FileField(required=False)
-    self.fields['allegati'] = MultipleFileField(required=False)
-
-class formUtente(forms.Form):
-  def __init__(self,*args,**kwargs):
-    forms.Form.__init__(self,*args,**kwargs)
-    self.fields['codicefiscale'] = forms.CharField(required=True)
-    self.fields['nome'] = forms.CharField(required=True)
-    self.fields['datanascita'] = forms.DateField(required=True) #,input_formats=['%d/%m/%Y',])
-    self.fields['luogonascita'] = forms.CharField(required=False)
-    self.fields['password'] = forms.CharField(required=False)
-    self.fields['mail'] = forms.CharField(required=False)
-    self.fields['CancellaUtente'] = forms.BooleanField(required=False)

+ 109 - 0
utente/templates/utente.edit.document.html

@@ -0,0 +1,109 @@
+<div class="tab-pane fade" id="document-pane" role="tabpanel" aria-labelledby="document-tab" tabindex="0">
+   <!-- documenti -->  
+
+   <div class='form-outline mb-3 text-center btn-primary h3'>
+           Elenco Documenti Associati
+   </div>
+   
+   <table class='table table-striped table-hover'>
+    <thead class='thead-dark'>
+      <tr>
+        <th scope='col'>Documento</th>
+        <th scope='col'>Storage</th>
+        <th scope='col'>Descrizione</th>
+        <th scope='col'>Inserimento</th>
+        <th scope='col'>Elimina</th>
+
+      </tr>
+    </thead>
+    <tbody>
+      {% for documento in documentiUtente %}
+        <tr>
+          <td> {{ documento.documento }} </td>
+          <td> {{ documento.storage}} </td>
+          <td> {{ documento.descrizione }} </td>
+          <td> {{ documento.dataupload | date:'d/m/Y' }} </td>
+          <!-- <td> <input class='btn btn-primary' type='submit' name='Elimina' value='{{ documento.id }}'></td> -->
+          <td> <button type='button' class='btn btn-primary active' onclick="window.open('{% url "documento:finalize" documento.id uid %}')">Vedi</button>
+               <button type='button' class='btn btn-primary' data-bs-toggle='modal' data-bs-target='#ConfirmDeleteModal{{ documento.id }}' value='{{ documento.id }}'>Elimina!</button></td>
+          <td>
+
+        <!-- Modal -->
+        <div class="modal fade" id="ConfirmDeleteModal{{ documento.id }}" tabindex="-1" role="dialog" aria-labelledby="ConfirmDeleteLabel{{ document.id }}" aria-hidden="true">
+          <div class="modal-dialog" role="document">
+            <div class="modal-content">
+              <div class="modal-header">
+               <h5 class="modal-title" id="ConfirmDeleteLabel">Conferma Cancellazione</h5>
+               <button type="button" class="close" data-bs-dismiss="modal" aria-label="Close">
+                 <span aria-hidden="true">&times;</span>
+               </button>
+             </div>
+             <div class="modal-body">
+             Confermi la cancellazione di {{ documento.documento }}?<br>
+             La cancellazione del documento è definitiva,immediata e non recuperabile.
+            </div>
+            <div class="modal-footer">
+              <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
+              <form name='ConfirmDeleteModal' method='POST'>
+                {% csrf_token %}
+                <button type="submit" name="DeleteDocument" value='{{ documento.id }}' class="btn btn-primary">Conferma</button>
+              </form>
+            </div>
+          </div>
+        </div>
+      <!-- end modal -->
+        </td>
+        </tr>
+      {% endfor %}
+     </tbody>
+   </table>
+
+   <form name='fileManager' method="POST"  enctype='multipart/form-data'>
+     {% csrf_token %}
+     <div class='form-group'>
+     <input type='file' class="btn btn-primary form-control" name='allegati' id='allegati' value='{{ uf.allegati }}' accept='application/pdf' multiple>
+     </div>
+     <div class='form-group'>
+     <label  class='form-control-label' for='descrizione'>Descrizione:&nbsp;</label><input type='text' name='descrizione' id='descrizione' value=''>
+     </div>
+     <input class="btn btn-primary" type='submit' value='Inserisci'>
+   </form>
+
+   {% if listaok %}
+     <table class='table table-striped table-hover'>
+       <thead class='thead-dark'>
+       <tr>
+         <th scope='col'>Documento caricato con successo</th>
+       </tr>
+       </thead>
+       <tbody>
+         {% for l in listaok %}
+         <tr>
+           <td> {{ l }} </td>
+         </tr>
+         {% endfor %}
+       </tbody>
+    </table>
+  {% endif %}
+
+  <div><br><br></div>
+
+  {% if listanotok %}
+    <table class='table table-striped table-hover'>
+      <thead class='thead-dark'>
+      <tr>
+        <th scope='col'>Documento non caricato perche già presente</th>
+      </tr>
+      </thead>
+      <tbody>
+        {% for l in listanotok %}
+        <tr>
+          <td> {{ l }} </td>
+        </tr>
+        {% endfor %}
+      </tbody>
+    </table>
+  {% endif %}
+  
+ </div>
+

+ 8 - 200
utente/templates/utente.edit.html

@@ -17,216 +17,24 @@
 <!-- Nav tabs -->
 <ul class="nav nav-tabs" id="myTab" role="tablist">
   <li class="nav-item" role="presentation">
-    <button class="nav-link active" id="home-tab" data-bs-toggle="tab" data-bs-target="#profile" type="button" role="tab" aria-controls="Profile" aria-selected="true">Profilo</button>
+    <button class="nav-link active" id="profile-tab" data-bs-toggle="tab" data-bs-target="#profile-pane" type="button" role="tab" aria-controls="profile-pane" aria-selected="true">Profilo</button>
   </li>
   <li class="nav-item" role="presentation">
-    <button class="nav-link" id="profile-tab" data-bs-toggle="tab" data-bs-target="#documents" type="button" role="tab" aria-controls="Documents" aria-selected="false">Documenti</button>
+    <button class="nav-link" id="document-tab" data-bs-toggle="tab" data-bs-target="#document-pane" type="button" role="tab" aria-controls="document-pane" aria-selected="false">Documenti</button>
   </li>
   <li class="nav-item" role="presentation">
-    <button class="nav-link" id="messages-tab" data-bs-toggle="tab" data-bs-target="#messages" type="button" role="tab" aria-controls="Messages" aria-selected="false">Logging</button>
+    <button class="nav-link" id="logger-tab" data-bs-toggle="tab" data-bs-target="#logger-pane" type="button" role="tab" aria-controls="logger-pane" aria-selected="false">attivita</button>
   </li>
 </ul>
 <!-- end nav tabs -->
 
 <!-- Tab panes -->
-<div class="tab-content">
-  <div class="tab-pane active" id="profiles" role="tabpanel" aria-labelledby="profile-tab" tabindex="0">
-    <div>
-    {% if utente.errors %}
-      {{ utente.errors }}
-      {% for field in utente %}
-        {% for error in field.errors %}
-          <div class="alert alert-danger">
-            <strong>{{ error|escape }}</strong>
-          </div>
-        {% endfor %}
-      {% endfor %}
-      {% for error in utente.non_field_errors %}
-        <div class="alert alert-danger">
-            <strong>{{ error|escape }}</strong>
-        </div>
-      {% endfor %}
-    {% else %}
-      Nessun Errore rilevato
-    {% endif %}
-    </div>
-
-    <!-- editing parametri utente -->
-    <form name='UserEdit' method='post'>
-      {% csrf_token %}
-      <div class='form-group'>
-      <label for="codicefiscale">Codice Fiscale</label>
-      <input type='text' class='form-control' name='codicefiscale' id='codicefiscale' value='{{ utente.codicefiscale.value }}'>
-
-      <label for="nome">Nome Cognome</label>
-      <input type='text' class='form-control form-control-lg' name='nome' id='nome' value='{{ utente.nome.value }}'>
-
-      <label for="luogonascita">Luogo di nascita</label>
-      <input type='text' class='form-control' name='luogonascita' id='luogonascita' value='{{ utente.luogonascita.value }}'>
-
-      <label for="datanascita">Data di nascita</label>
-      <input type='date' class='form-control' name='datanascita' id='datanascita' value='{{ utente.datanascita.value|date:'Y-m-d' }}'>
-
-      <label for="mail" class="form-control-label">Email</label>
-      <input type='mail' class='form-control' name='mail' id='mail' value='{{ utente.mail.value }}'
-
-      <label for="pin" class='form-control-label'>Pin</label>
-      <input type='text' class='form-control' name='pin' id='pin' value='{{ utente.pin.value }}'
-      </div>
-
-      <div class="form-check">
-      <input type="checkbox" class="form-check-input" name='CancellaUtente' id='CancellaUtente'>
-      <Label class="form-check-label" for='CancellaUtente'>Cancella Questo record!</label>
-      </div>
-
-      <div class='form-check'>
-      <input type='submit' class="btn btn-secondary" value='Aggiorna'>
-      <input type='submit' class="btn btn-primary" name="ritorna" value="Ritorna">
-      </div>
-    </form>
-   <!-- fine del form di editing -->
- </div>
-
- <div class="tab-pane" id="profile" role="tabpanel" aria-labelledby="document-tab" tabindex="0">
-   <!-- documenti -->  
-   <div><br><br></div>
-
-   <div class='form-outline mb-3 text-center btn-primary h3'>
-           Elenco Documenti Associati
-   </div>
-   
-   <table class='table table-striped table-hover'>
-    <thead class='thead-dark'>
-      <tr>
-        <th scope='col'>Documento</th>
-        <th scope='col'>Storage</th>
-        <th scope='col'>Descrizione</th>
-        <th scope='col'>Inserimento</th>
-        <th scope='col'>Elimina</th>
-
-      </tr>
-    </thead>
-    <tbody>
-      {% for documento in documentiUtente %}
-        <tr>
-          <td> {{ documento.documento }} </td>
-          <td> {{ documento.storage}} </td>
-          <td> {{ documento.descrizione }} </td>
-          <td> {{ documento.dataupload | date:'d/m/Y' }} </td>
-          <!-- <td> <input class='btn btn-primary' type='submit' name='Elimina' value='{{ documento.id }}'></td> -->
-          <td> <button type='button' class='btn btn-primary active' onclick="window.open('{% url "documento:finalize" documento.id uid %}')">Vedi</button>
-               <button type='button' class='btn btn-primary' data-bs-toggle='modal' data-bs-target='#ConfirmDeleteModal{{ documento.id }}' value='{{ documento.id }}'>Elimina!</button></td>
-          <td>
-
-        <!-- Modal -->
-        <div class="modal fade" id="ConfirmDeleteModal{{ documento.id }}" tabindex="-1" role="dialog" aria-labelledby="ConfirmDeleteLabel{{ document.id }}" aria-hidden="true">
-          <div class="modal-dialog" role="document">
-            <div class="modal-content">
-              <div class="modal-header">
-               <h5 class="modal-title" id="ConfirmDeleteLabel">Conferma Cancellazione</h5>
-               <button type="button" class="close" data-bs-dismiss="modal" aria-label="Close">
-                 <span aria-hidden="true">&times;</span>
-               </button>
-             </div>
-             <div class="modal-body">
-             Confermi la cancellazione di {{ documento.documento }}?<br>
-             La cancellazione del documento è definitiva,immediata e non recuperabile.
-            </div>
-            <div class="modal-footer">
-              <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
-              <form name='ConfirmDeleteModal' method='POST'>
-                {% csrf_token %}
-                <button type="submit" name="DeleteDocument" value='{{ documento.id }}' class="btn btn-primary">Conferma</button>
-              </form>
-            </div>
-          </div>
-        </div>
-      <!-- end modal -->
-        </td>
-        </tr>
-      {% endfor %}
-     </tbody>
-   </table>
-
-   <form name='fileManager' method="POST"  enctype='multipart/form-data'>
-     {% csrf_token %}
-     <td><label for='descrizione'>Descrizione:&nbsp;</label><input type='text' name='descrizione' id='descrizione' value=''>
-     <td><input type='file' class="btn btn-primary" name='allegati' id='allegati' value='{{ uf.allegati }}' accept='application/pdf' multiple></td>
-     <td><input class="btn btn-primary" type='submit' value='Inserisci'><td>
-   </form>
-
-   <div><br><br></div>
-
-   {% if listaok %}
-     <table class='table table-striped table-hover'>
-       <thead class='thead-dark'>
-       <tr>
-         <th scope='col'>Documento caricato con successo</th>
-       </tr>
-       </thead>
-       <tbody>
-         {% for l in listaok %}
-         <tr>
-           <td> {{ l }} </td>
-         </tr>
-         {% endfor %}
-       </tbody>
-    </table>
-  {% endif %}
-
-  <div><br><br></div>
-  {% if listanotok %}
-    <table class='table table-striped table-hover'>
-      <thead class='thead-dark'>
-      <tr>
-        <th scope='col'>Documento non caricato perche già presente</th>
-      </tr>
-      </thead>
-      <tbody>
-        {% for l in listanotok %}
-        <tr>
-          <td> {{ l }} </td>
-        </tr>
-        {% endfor %}
-      </tbody>
-    </table>
-  {% endif %}
-  
- </div>
-
- <div class="tab-pane" id="profile" role="tabpanel" aria-labelledby="profile-tab" tabindex="0">
-
-   <div><br><br></div>
-
-   <div class='form-outline mb-3 text-center btn-primary h3'>
-          Elenco Azioni Registrate
-   </div>
-
-   <div>
-   <table class='table table-striped table-hover'>
-     <thead class='thead-dark'>
-       <tr>
-         <th scope='col'>Data</th>
-          <th scope='col'>Causale</th>
-          <th scope='col'>Utente</th>
-          <th scope='col'>Amministratore</th>
-          <th scope='col'>documento</th>
-        </tr>
-      </thead>
-      <tbody>
-       {% for attivita in listaAttivita %}
-       <tr>
-         <td> {{ attivita.data | date:'d/m/Y H:i' }} </td>
-         <td> {{ attivita.causale.nome }} </td>
-         <td> {{ attivita.utente.nome }} </td>
-         <td> {{ attivita.amministratore.name }}</td>
-         <td> {{ attivita.documento.documento }}</td>
-       </tr>
-       {% endfor %}
-     </tbody>
-   </table>
-   </div>
+<div class="tab-content" id='mycontent'>
+  {% include 'utente.edit.profile.html' %}
+  {% include 'utente.edit.document.html' %}
+  {% include 'utente.edit.logger.html' %}
 </div>
+
 {% endblock %}
 
 {% block bodybottom %}

+ 31 - 0
utente/templates/utente.edit.logger.html

@@ -0,0 +1,31 @@
+ <div class="tab-pane fade" id="logger-pane" role="tabpanel" aria-labelledby="logger-tab" tabindex="0">
+
+   <div class='form-outline mb-3 text-center btn-primary h3'>
+          Elenco Azioni Registrate
+   </div>
+
+   <div>
+   <table class='table table-striped table-hover'>
+     <thead class='thead-dark'>
+       <tr>
+         <th scope='col'>Data</th>
+          <th scope='col'>Causale</th>
+          <th scope='col'>Utente</th>
+          <th scope='col'>Amministratore</th>
+          <th scope='col'>documento</th>
+        </tr>
+      </thead>
+      <tbody>
+       {% for attivita in listaAttivita %}
+       <tr>
+         <td> {{ attivita.data | date:'d/m/Y H:i' }} </td>
+         <td> {{ attivita.causale.nome }} </td>
+         <td> {{ attivita.utente.nome }} </td>
+         <td> {{ attivita.amministratore.name }}</td>
+         <td> {{ attivita.documento.documento }}</td>
+       </tr>
+       {% endfor %}
+     </tbody>
+   </table>
+   </div>
+</div>

+ 63 - 0
utente/templates/utente.edit.profile.html

@@ -0,0 +1,63 @@
+<div class="tab-pane fade show active" id="profile-pane" role="tabpanel" aria-labelledby="profile-tab" tabindex="0">
+
+  <!-- errori utente -->
+  {% if utente.errors %}
+    {{ utente.errors }}
+    {% for field in utente %}
+      {% for error in field.errors %}
+        <div class="alert alert-danger">
+          <strong>{{ error|escape }}</strong>
+        </div>
+      {% endfor %}
+    {% endfor %}
+    {% for error in utente.non_field_errors %}
+      <div class="alert alert-danger">
+          <strong>{{ error|escape }}</strong>
+      </div>
+    {% endfor %}
+  {% else %}
+    Nessun Errore rilevato
+  {% endif %}
+  <!-- fine zona errori -->
+
+  <!-- profilo utente -->
+  <form name='UserEdit' method='post'>
+    {% csrf_token %}
+
+    <div class='form-group'>
+      <label for="codicefiscale">Codice Fiscale</label>
+      <input type='text' class='form-control' name='codicefiscale' id='codicefiscale' value='{{ utente.codicefiscale.value }}'>
+    </div>
+    <div class='form-group'>
+      <label for="nome">Nome Cognome</label>
+      <input type='text' class='form-control form-control-lg' name='nome' id='nome' value='{{ utente.nome.value }}'>
+    </div>
+    <div class='form-group'>
+      <label for="luogonascita">Luogo di nascita</label>
+      <input type='text' class='form-control' name='luogonascita' id='luogonascita' value='{{ utente.luogonascita.value }}'>
+    </div>
+    <div class='form-group'>
+      <label for="datanascita">Data di nascita</label>
+      <input type='date' class='form-control' name='datanascita' id='datanascita' value='{{ utente.datanascita.value|date:'Y-m-d' }}'>
+    </div>
+    <div class='form-group'>
+      <label for="mail" class="form-control-label">Email</label>
+      <input type='mail' class='form-control' name='mail' id='mail' value='{{ utente.mail.value }}'>
+    </div>
+
+    <div class='form-group'>
+      <label for="pin" class='form-control-label'>Pin</label>
+      <input type='text' class='form-control' name='pin' id='pin' value='{{ utente.pin.value }}'>
+    </div>
+
+    <div class='form-check'>
+      <input type="checkbox" class="form-check-input" name='CancellaUtente' id='CancellaUtente'>
+      <Label class="form-check-label" for='CancellaUtente'>Cancella Questo record!</label>
+    </div>
+
+    <input type='submit' class="btn btn-secondary" value='Aggiorna'>
+    <input type='submit' class="btn btn-primary" name="ritorna" value="Ritorna">
+  </form>
+
+</div>
+

+ 0 - 55
utente/templates/utente.welcome.html.old

@@ -1,55 +0,0 @@
-{% extends 'base.html' %}
-
-{% block top %}
-  <table class='table table-striped table-hover'>
-    <thead class='thead-dark'>
-      <tr>
-        <th scope='col'>Nome</th>
-        <th scope='col'>Codice Fiscale</th>
-        <th scope='col'>Data di Nascita</th>
-	<th scope='col'>Luogo di Nascita</th>
-	<th scope='col'>documento</th>
-	<th scope='col'>Data Documento</th>
-	<th scope='col'>Azienda</th>
-	<th scope='col'>Password</th>
-      </tr>
-    </thead>
-    <tbody>
-      {% csrf_token %}
-      {% for uu in u %}
-        <tr>
-	  <td><a href='{% url 'welcome:edit' uu.id %}'>{{ uu.nome }}</a> </td>
-	  <td> {{ uu.codicefiscale }} </td>
-	  <td> {{ uu.datanascita|date:'d/m/Y' }} </td>
-	  <td> {{ uu.luogonascita }} </td>
-	  <td> {{ uu.documento }} </td>
-	  <td> {% if uu.dataupload %} {{ uu.dataupload }} {% endif %}</td>
-	  <td> {{ uu.azienda }} </td>
-	  <td> {{ uu.password }} </td>
-	</tr>
-      {% endfor %} 
-    </tbody>
-  </table>
-  <div class='form-control'>
-    <a href='{% url 'welcome:edit' 0 %}'>Nuovo Record</a>
-  </div>
-{% endblock %}
-
-{% block body %}
-  <div>
-	  &nbsp;
-  </div>
-  <br>
-  <form name='upload' method='post' enctype='multipart/form-data'>
-    {% csrf_token %}
-    <table class='table table-striped table-hover'>
-      <tbody>
-        <tr>
-	  <td><input type='file' name='indice' id='indice' value='{{ uf.indice }}' accept='text/csv'></td>
-	  <td><input type='file' name='allegati' id='allegati' value='{{ uf.allegati }}' accept='application/pdf' multiple></td>
-	  <td><input type='submit' value='Inserisci'></td>
-        </tr>
-      </tbody>
-    </table>
-  </form>
-{% endblock %}

+ 0 - 121
utente/views.py~

@@ -1,121 +0,0 @@
-from django.shortcuts import render
-from django.http import HttpResponse,HttpResponseRedirect,FileResponse
-from django.contrib.auth.models import User
-from django.urls import reverse
-
-from .models import *
-from .forms import *
-
-from config.views import *
-
-def welcome(request):
-
-  data = dict()
-  data['HeaderTitle'] = getConfig('HeaderTitle')
-
-  if not 'AziendaId' in request.session:
-    return HttpResponseRedirect(reverse("login:start"))
-  else:
-    data['AziendaId'] = request.session['AziendaId']
-
-  if not 'AdminId' in request.session or 'UserId' in request.session:
-    print("Non rilevo presensa UserId e AdminId in request.session")
-    return HttpResponseRedirect(reverse("login:start"))
-
-  if 'AdminId' in request.session:
-    data['AdminId'] = request.session['AdminId']
-    
-  if 'UserId' in request.session:
-    data['UserId'] = request.session['UserId']
-
-  #filtro:
-  # selezionare tutti gli utenti per AziendaId
-  data['admin'] = User.objects.get(pk=data['AdminId'])
-
-  data['azienda'] = Azienda.objects.get(pk=data['AziendaId'])
-  data['utenti'] = data['azienda'].utente_set.all()
-
-  if request.method == 'POST':
-    print('qualcuno ha premuto un id')
-    if 'scelta' in request.POST:
-      scelta = request.POST['scelta']
-      request.session['UserEditId'] = scelta
-      print('scelta effettuata',scelta)
-      return HttpResponseRedirect(reverse("utente:edit"))
-
-  return render(request,'utente.welcome.html',data)
-
-def edit(request):
-
-  data=dict()
-
-  if not 'AdminId' in request.session:
-    return HttpResponseRedirect(reverse("login:start"))
-  data['AdminId']=request.session['AdminId']
-
-  if not 'AziendaId' in request.session:
-    return HttpResponseRedirect(reverse("login:start"))
-  data['AziendaId']=request.session['AziendaId']
-
-  if not 'AdminId' in request.session or 'UserId' in request.session:
-    print("Non rilevo presensa UserId e AdminId in request.session")
-    return HttpResponseRedirect(reverse("login:start"))
-
-  if 'AdminId' in request.session:
-    data['AdminId'] = request.session['AdminId']
-    
-  if 'UserId' in request.session:
-    data['UserId'] = request.session['UserId']
-
-  if not'UserEditId' in request.session:
-    return HttpResponseRedirect(reverse("login:start"))
-  data['UserEditId'] = request.session['UserEditId']
-
-  #filtro:
-  # selezionare tutti gli utenti per AziendaId
-  data['admin'] = User.objects.get(pk=data['AdminId'])
-
-  data['azienda'] = Azienda.objects.get(pk=data['AziendaId'])
- 
-  utente = None
-  if data['UserEditId'] == 0:
-    utente = Utente()
-    utente.azienda = data['azienda']
-  else:
-    try:
-      utente = Utente.objects.get(pk=data['UserEditId'])
-    except Utente.DoesNotExist as dne:
-      print('strana richiesta, utente inesistente')
-      flagDne=True
-      utente=None
-      print("Non ci siamo, manca l'utente")
-
-  if request.method == 'POST':
-    print('request.method x edit utente')
-    fu = formUtente(request.POST)
-    if fu.is_valid():
-      print('form valida')
-      print('i dati sono grosso modo coerenti, salviamoli')
-      utente.nome = fu.cleaned_data['nome']
-      utente.codicefiscale = fu.cleaned_data['codicefiscale']
-      utente.luogonascita = fu.cleaned_data['luogonascita']
-      utente.datanascita = fu.cleaned_data['datanascita']
-      utente.mail = fu.cleaned_data['mail']
-      utente.save()
-      data['utente'] = formUtente(request.POST)
-    else:
-      print('Form non valida')
-      data['utente'] = formUtente(request.POST)
-
-  else:
-    print('Request non valida')
-    tmp = dict()
-    tmp['nome'] = utente.nome
-    tmp['codicefiscale'] = utente.codicefiscale
-    tmp['datanascita'] = utente.datanascita
-    tmp['luogonascita'] = utente.luogonascita
-    tmp['mail'] = utente.mail
-    data['utente'] = formUtente(tmp)
-
-  return render(request,'utente.edit.html',data)
-