fix: Correction dépendances circulaires

This commit is contained in:
N3WT DE COMPET
2025-05-12 15:16:46 +02:00
parent 52bba46cbb
commit fc9a1ed252
11 changed files with 70 additions and 60 deletions

View File

@ -3,11 +3,8 @@ from django.utils.timezone import now
from django.conf import settings
from django.utils.translation import gettext_lazy as _
from School.models import SchoolClass, Fee, Discount, PaymentModeType, PaymentPlanType
from Auth.models import ProfileRole
from Establishment.models import Establishment
from datetime import datetime
from School.models import PaymentModeType, PaymentPlanType
import os
@ -31,7 +28,7 @@ class Guardian(models.Model):
address = models.CharField(max_length=200, default="", blank=True)
phone = models.CharField(max_length=200, default="", blank=True)
profession = models.CharField(max_length=200, default="", blank=True)
profile_role = models.OneToOneField(ProfileRole, on_delete=models.CASCADE, related_name='guardian_profile', null=True, blank=True)
profile_role = models.OneToOneField('Auth.ProfileRole', on_delete=models.CASCADE, related_name='guardian_profile', null=True, blank=True)
@property
def email(self):
@ -100,19 +97,19 @@ class Student(models.Model):
profiles = models.ManyToManyField('Auth.Profile', blank=True)
# Many-to-Many Relationship
guardians = models.ManyToManyField(Guardian, blank=True)
guardians = models.ManyToManyField('Subscriptions.Guardian', blank=True)
# Many-to-Many Relationship
siblings = models.ManyToManyField(Sibling, blank=True)
siblings = models.ManyToManyField('Subscriptions.Sibling', blank=True)
# Many-to-Many Relationship
registration_files = models.ManyToManyField('RegistrationSchoolFileTemplate', blank=True, related_name='students')
registration_files = models.ManyToManyField('Subscriptions.RegistrationSchoolFileTemplate', blank=True, related_name='students')
# Many-to-Many Relationship
spoken_languages = models.ManyToManyField(Language, blank=True)
spoken_languages = models.ManyToManyField('Subscriptions.Language', blank=True)
# One-to-Many Relationship
associated_class = models.ForeignKey(SchoolClass, on_delete=models.SET_NULL, null=True, blank=True, related_name='students')
associated_class = models.ForeignKey('School.SchoolClass', on_delete=models.SET_NULL, null=True, blank=True, related_name='students')
def __str__(self):
return self.last_name + "_" + self.first_name
@ -190,7 +187,7 @@ class Student(models.Model):
class RegistrationFileGroup(models.Model):
name = models.CharField(max_length=255, default="")
description = models.TextField(blank=True, null=True)
establishment = models.ForeignKey(Establishment, on_delete=models.CASCADE, related_name='file_group', null=True, blank=True)
establishment = models.ForeignKey('Establishment.Establishment', on_delete=models.CASCADE, related_name='file_group', null=True, blank=True)
def __str__(self):
return self.name
@ -239,17 +236,17 @@ class RegistrationForm(models.Model):
associated_rf = models.CharField(max_length=200, default="", blank=True)
# Many-to-Many Relationship
fees = models.ManyToManyField(Fee, blank=True, related_name='register_forms')
fees = models.ManyToManyField('School.Fee', blank=True, related_name='register_forms')
# Many-to-Many Relationship
discounts = models.ManyToManyField(Discount, blank=True, related_name='register_forms')
discounts = models.ManyToManyField('School.Discount', blank=True, related_name='register_forms')
fileGroup = models.ForeignKey(RegistrationFileGroup,
on_delete=models.SET_NULL,
related_name='register_forms',
null=True,
blank=True)
establishment = models.ForeignKey(Establishment, on_delete=models.CASCADE, related_name='register_forms')
establishment = models.ForeignKey('Establishment.Establishment', on_delete=models.CASCADE, related_name='register_forms')
registration_payment = models.IntegerField(choices=PaymentModeType.choices, null=True, blank=True)
tuition_payment = models.IntegerField(choices=PaymentModeType.choices, null=True, blank=True)
registration_payment_plan = models.IntegerField(choices=PaymentPlanType.choices, null=True, blank=True)
@ -386,7 +383,7 @@ class AbsenceManagement(models.Model):
on_delete=models.CASCADE,
related_name='absences'
)
establishment = models.ForeignKey(Establishment, on_delete=models.CASCADE, related_name='absences')
establishment = models.ForeignKey('Establishment.Establishment', on_delete=models.CASCADE, related_name='absences')
def __str__(self):
return f"{self.student} - {self.day} - {self.get_moment_display()} - {self.get_reason_display()}"