Hi
I am new on this forum and very, very new user of Django so hope you will be uncensorious
I need to implement the safedelete application (https://buildmedia.readthedocs.org/media/pdf/django-safedelete/latest/django-safedelete.pdf) for my project but I should have miss something in the documentation because I did non manage tu use it correctly
I will expose you briefly my problem
I have 2 classes BiologyAssessment and BiologyExam linked with a foreignKey: a biologicalassessment is linked with multiple biologicalexam
When I delete a biologicalassessment, I want related biologicalexamn to be 'delete' (but soft delete)
When I delete a biologicalexam, I want biologicalexam to be delete (soft delete)
I have implemented in my project but unfortunetly, when I delete a biologicalexam, the linked biologicalasessment is also delete
I have try different to use _safedelete_policy = SOFT_DELETE for my BiologicalExam class but it does not chage anything
could you help me ?
models.py
class BiologicalAssessment(SafeDeleteModel):
_safedelete_policy = SOFT_DELETE_CASCADE
ide = models.AutoField(primary_key=True)
vis_ref = models.ForeignKey(Visite, verbose_name='Visite', related_name='bilan', on_delete=models.CASCADE)
bio_prv_dat = models.DateField("Date de prélèvement")
class BiologicalExam(SafeDeleteModel):
_safedelete_policy = SOFT_DELETE_CASCADE
ide = models.AutoField(primary_key=True)
bio_ref = models.ForeignKey(BiologicalAssessment, verbose_name='Bilans', related_name='examen', on_delete=models.CASCADE)
bio_exa_cod = models.CharField("Type d'examen", max_length=3)
bio_exa_val = models.FloatField("Résultat de l'examen")
bio_exa_uni = models.CharField("Unité", max_length=50)
bio_exa_val_inf = models.FloatField("Limite inférieure")
bio_exa_val_sup = models.FloatField("Limite supérieure")
_safedelete_policy = SOFT_DELETE_CASCADE
ide = models.AutoField(primary_key=True)
vis_ref = models.ForeignKey(Visite, verbose_name='Visite', related_name='bilan', on_delete=models.CASCADE)
bio_prv_dat = models.DateField("Date de prélèvement")
class BiologicalExam(SafeDeleteModel):
_safedelete_policy = SOFT_DELETE_CASCADE
ide = models.AutoField(primary_key=True)
bio_ref = models.ForeignKey(BiologicalAssessment, verbose_name='Bilans', related_name='examen', on_delete=models.CASCADE)
bio_exa_cod = models.CharField("Type d'examen", max_length=3)
bio_exa_val = models.FloatField("Résultat de l'examen")
bio_exa_uni = models.CharField("Unité", max_length=50)
bio_exa_val_inf = models.FloatField("Limite inférieure")
bio_exa_val_sup = models.FloatField("Limite supérieure")
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/0e88df26-bd24-430d-a432-7094a194183d%40googlegroups.com.
No comments:
Post a Comment