Ver Fonte

migliorare l'integrazione l'autenticazione django

mauro há 1 ano atrás
pai
commit
db4cd4eb7d

+ 1 - 1
azienda/views.py

@@ -96,7 +96,7 @@ def edit(request):
       request.session['aziendaId'] = azienda.id
       assegnazione = Assegnazione()
       assegnazione.azienda=azienda
-      assegnazione.utente=User.objects.get(pk=AdminId)
+      assegnazione.user=User.objects.get(pk=AdminId)
       assegnazione.save()
       return HttpResponseRedirect(reverse('azienda:welcome'))
     else:

+ 18 - 0
utente/migrations/0010_utente_admin.py

@@ -0,0 +1,18 @@
+# Generated by Django 5.1.3 on 2024-11-28 16:22
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('utente', '0009_utente_daticompleti_utente_encrypt_utente_primologin_and_more'),
+    ]
+
+    operations = [
+        migrations.AddField(
+            model_name='utente',
+            name='admin',
+            field=models.BooleanField(default=0),
+        ),
+    ]

+ 22 - 0
utente/migrations/0011_remove_utente_unique_utente_utente_unique_utente.py

@@ -0,0 +1,22 @@
+# Generated by Django 5.1.3 on 2024-11-28 16:26
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('azienda', '0003_azienda_azienda_azi_partita_d03251_idx'),
+        ('utente', '0010_utente_admin'),
+    ]
+
+    operations = [
+        migrations.RemoveConstraint(
+            model_name='utente',
+            name='unique-utente',
+        ),
+        migrations.AddConstraint(
+            model_name='utente',
+            constraint=models.UniqueConstraint(fields=('nome', 'codicefiscale', 'admin'), name='unique-utente'),
+        ),
+    ]

+ 26 - 0
utente/migrations/0012_remove_utente_unique_utente_remove_utente_admin_and_more.py

@@ -0,0 +1,26 @@
+# Generated by Django 5.1.3 on 2024-11-28 16:38
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('azienda', '0003_azienda_azienda_azi_partita_d03251_idx'),
+        ('utente', '0011_remove_utente_unique_utente_utente_unique_utente'),
+    ]
+
+    operations = [
+        migrations.RemoveConstraint(
+            model_name='utente',
+            name='unique-utente',
+        ),
+        migrations.RemoveField(
+            model_name='utente',
+            name='admin',
+        ),
+        migrations.AddConstraint(
+            model_name='utente',
+            constraint=models.UniqueConstraint(fields=('nome', 'codicefiscale'), name='unique-utente'),
+        ),
+    ]