| 1234567891011121314151617181920212223242526272829303132333435363738 |
- from django.db import models
- from django.utils import timezone
- class Amministratore(models.Model):
- login = models.CharField(max_length=64,null=False)
- nome = models.CharField(max_length=128,null=False,unique=True)
- mail = models.CharField(max_length=128,null=False,default="")
- pin = models.CharField(max_length=64,null=False)
- '''
- uuid = models.CharField(max_length=32,null=False,default="")
- sola_lettura = models.BooleanField(default=False)
- crea_azienda = models.BooleanField(default=True)
- crea_sede = models.BooleanField(default=True)
- crea_utente = models.BooleanField(default=True)
- crea_documento = models.BooleanField(default=True)
- crea_comunicazione = models.BooleanField(default=True)
- edit_azienda = models.BooleanField(default=True)
- edit_sede = models.BooleanField(default=True)
- edit_utente = models.BooleanField(default=True)
- edit_documento = models.BooleanField(default=True)
- edit_comunicazione = models.BooleanField(default=True)
- crea_permesso = models.BooleanField(default=False)
- edit_permesso = models.BooleanField(default=False)
- read_permesso = models.BooleanField(default=True)
- '''
- def __str__(self):
- return f"{self.id}: {self.nome}"
- class Permesso(models.Model):
- nome=models.CharField(null=True,max_length=20)
- descrizione=models.CharField(null=True,max_length=128)
- def __str__(self):
- return f"{self.id}: {self.nome}"
- class AP(models.Model):
- # AP: Associazione Permessi
- amministratore = models.ForeignKey(Amministratore,on_delete=models.PROTECT)
- permesso = models.ForeignKey(Permesso,on_delete=models.PROTECT)
|