Commit 0dcacc3af8d8b2ee89ca80d844f238c0f31bf2ea

Authored by pyros_astroguita
1 parent 9d521608
Exists in dev

fix on delete for quota

Showing 1 changed file with 3 additions and 3 deletions   Show diff stats
src/core/pyros_django/user_mgmt/models.py
@@ -87,7 +87,7 @@ class Institute(models.Model): @@ -87,7 +87,7 @@ class Institute(models.Model):
87 quota_f = models.FloatField( 87 quota_f = models.FloatField(
88 validators=[MinValueValidator(0), MaxValueValidator(1)], blank=True, null=True) 88 validators=[MinValueValidator(0), MaxValueValidator(1)], blank=True, null=True)
89 89
90 - quota = models.ForeignKey(Quota, on_delete=models.DO_NOTHING,related_name="institute_quotas", blank=True, null=True) 90 + quota = models.ForeignKey(Quota, on_delete=models.SET_NULL,related_name="institute_quotas", blank=True, null=True)
91 #representative_user = models.ForeignKey("PyrosUser", on_delete=models.DO_NOTHING,related_name="institutes",default=1) 91 #representative_user = models.ForeignKey("PyrosUser", on_delete=models.DO_NOTHING,related_name="institutes",default=1)
92 92
93 def __str__(self) -> str: 93 def __str__(self) -> str:
@@ -375,7 +375,7 @@ class Period(models.Model): @@ -375,7 +375,7 @@ class Period(models.Model):
375 data_accessibility_duration = models.PositiveIntegerField( 375 data_accessibility_duration = models.PositiveIntegerField(
376 blank=True, null=True, default=365*10, editable=True) 376 blank=True, null=True, default=365*10, editable=True)
377 377
378 - quota = models.ForeignKey(Quota, on_delete=models.DO_NOTHING,related_name="period_quotas", blank=True, null=True) 378 + quota = models.ForeignKey(Quota, on_delete=models.SET_NULL,related_name="period_quotas", blank=True, null=True)
379 379
380 @property 380 @property
381 def end_date(self): 381 def end_date(self):
@@ -475,7 +475,7 @@ class ScientificProgram(models.Model): @@ -475,7 +475,7 @@ class ScientificProgram(models.Model):
475 science_theme = models.ForeignKey(ScienceTheme, on_delete=models.DO_NOTHING, related_name="scientific_program_theme", default=1) 475 science_theme = models.ForeignKey(ScienceTheme, on_delete=models.DO_NOTHING, related_name="scientific_program_theme", default=1)
476 is_auto_validated = models.BooleanField(default=False) 476 is_auto_validated = models.BooleanField(default=False)
477 objects = ScientificProgramManager() 477 objects = ScientificProgramManager()
478 - quota = models.ForeignKey(Quota, on_delete=models.DO_NOTHING, related_name="scientific_program_quotas", blank=True, null=True) 478 + quota = models.ForeignKey(Quota, on_delete=models.SET_NULL, related_name="scientific_program_quotas", blank=True, null=True)
479 quota_f = models.FloatField( 479 quota_f = models.FloatField(
480 validators=[MinValueValidator(0), MaxValueValidator(1)], blank=True, null=True) 480 validators=[MinValueValidator(0), MaxValueValidator(1)], blank=True, null=True)
481 481