from django.db import models from django.core.validators import MaxValueValidator from usuarios.models import Usuario class Proyecto(models.Model): referencia = models.CharField(max_length=200) titulo = models.CharField(max_length=200) tr = models.CharField(max_length=200) def __str__(self): return self.referencia class Accion(models.Model): descripcion = models.CharField(max_length=200) valor = models.DecimalField(max_digits=10, decimal_places=2, blank=True, null=True) fecha = models.DateField() def __str__(self): return str(self.descripcion) class Riesgo(models.Model): proyecto = models.ForeignKey(Proyecto, on_delete=models.CASCADE) fecha = models.DateField() titulo = models.CharField(max_length=200) descripcion = models.CharField(max_length=200) responsable = models.ForeignKey(Usuario, on_delete=models.DO_NOTHING) importe = models.DecimalField(max_digits=10, decimal_places=2, blank=True, null=True) probabilidad = models.DecimalField(max_digits=4, decimal_places=0, blank=True, null=True) valor = models.DecimalField(max_digits=10, decimal_places=2, blank=True, null=True) fecha_liberacion = models.DateField() a_liberar = models.BooleanField(default=False) a_ejecutar = models.BooleanField(default=False) accion = models.ForeignKey(Accion, on_delete=models.CASCADE, blank=True, null=False) def __str__(self): return str(self.titulo)