From a3f12a22f8c34494968f8a31c062304a8f4a7dcd Mon Sep 17 00:00:00 2001 From: Evarin Date: Wed, 26 Dec 2018 21:34:48 +0100 Subject: [PATCH] Indexation lowercase --- avisstage/documents.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/avisstage/documents.py b/avisstage/documents.py index 3995b3c..b2fcf50 100644 --- a/avisstage/documents.py +++ b/avisstage/documents.py @@ -46,27 +46,30 @@ class StageDocument(DocType): ] def prepare_thematiques(self, instance): - return ", ".join(instance.thematiques.all().values_list("name", flat=True)) + return ", ".join(instance.thematiques.all().values_list("name", flat=True)).lower() def prepare_matieres(self, instance): - return ", ".join(instance.matieres.all().values_list("nom", flat=True)) + return ", ".join(instance.matieres.all().values_list("nom", flat=True)).lower() def prepare_niveau_scol(self, instance): - return instance.get_niveau_scol_display() + return instance.get_niveau_scol_display().lower() def prepare_type_stage(self, instance): - return instance.type_stage_fancy + return instance.type_stage_fancy.lower() def prepare_date_fin(self, instance): return instance.date_fin.year def prepare_date_debut(self, instance): return instance.date_debut.year + + def prepare_sujet(self, instance): + return instance.sujet.lower() # Hook pour l'affichage des noms de pays def prepare(self, instance): data = super(StageDocument, self).prepare(instance) for lieu in data['lieux']: - lieu['pays'] = PAYS_DICT[lieu['pays']] + lieu['pays'] = PAYS_DICT[lieu['pays']].lower() return data