From 487c101bc8d217ecc8d56759968979d0cbbcd89c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Agn=C3=A8s=20Haasser?= Date: Thu, 14 Nov 2024 14:48:08 +0100 Subject: [PATCH] By default, select DS dossier with Projet objects --- gsl_projet/models.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gsl_projet/models.py b/gsl_projet/models.py index 02e75fb..20082ac 100644 --- a/gsl_projet/models.py +++ b/gsl_projet/models.py @@ -22,6 +22,9 @@ def for_user(self, user: Collegue): dossier_ds__ds_demarche__ds_instructeurs__ds_email=user.email ) + def get_queryset(self): + return super().get_queryset().select_related("dossier_ds") + class Projet(models.Model): # demandeur = models.ForeignKey(Demandeur, on_delete=models.PROTECT) @@ -34,7 +37,7 @@ class Projet(models.Model): objects = ProjetManager() def __str__(self): - return f"Projet {self.pk}" + return f"Projet {self.pk} — Dossier {self.dossier_ds.ds_number}" @classmethod def get_or_create_from_ds_dossier(cls, ds_dossier: Dossier):