Преглед изворни кода

1: azienda:view
ho riscontrato un errore in fase di creazione nuova azienda. anzi due
errori
2: ho fatto in modo che fosse visualizzato correttamente il campo
descrizione

mauro пре 1 година
родитељ
комит
38f68ea261
2 измењених фајлова са 5 додато и 3 уклоњено
  1. 4 2
      azienda/views.py
  2. 1 1
      documento/templates/documento.welcome.html

+ 4 - 2
azienda/views.py

@@ -52,8 +52,9 @@ def welcome(request):
         return HttpResponseRedirect(reverse('azienda:welcome'))
 
       print("sceltaazienda = ",request.POST.get('sceltaazienda'))
-      if sceltaazienda == 0: #richiesta una nuova azienda
-        data['AziendaId']=None
+      if sceltaazienda < 1 : #richiesta una nuova azienda
+        if 'AziendaId' in data:
+          data['AziendaId'] = none
         return HttpResponseRedirect(reverse('azienda:edit'))
       else:
         azienda = Azienda.objects.get(pk=sceltaazienda)
@@ -103,6 +104,7 @@ def edit(request):
   data['HeaderTitle'] = getConfig('HeaderTitle')
   user = data['admin'] = User.objects.get(pk=AdminId)
 
+  azienda = None
   if 'AziendaId' in request.session:
     print('trovato riferimento AziendaId',request.session.get('AziendaId'))
     azid = request.session.get('AziendaId')

+ 1 - 1
documento/templates/documento.welcome.html

@@ -84,7 +84,7 @@
           <td> <button type='button' class='btn btn-primary btn-block btn-lg mb-2 active' onclick="window.open('{% url "documento:finalize" documento.id documento.utente.id%}')">Vedi</button></td>
           <td> {{ documento.utente.nome }} </td>
 	  <td> {{ documento.documento }}<br>{{ documento.storage }} </td>
-          <td> {{ uu.descrizione }} </td>
+          <td> {{ documento.descrizione }} </td>
           <td> {{ documento.dataupload | date:'d/m/Y' }} </td>
           <td><button type='button' class='btn btn-secondary' data-bs-toggle='modal' data-bs-target='#ConfirmDeleteModal{{ documento.id }}' value='{{ documento.id }}'>Elimina</button></td>
         </tr>