From fde7a53e05dd204ba6bc16ee273f5f54716c7145 Mon Sep 17 00:00:00 2001 From: Evarin Date: Fri, 19 May 2017 22:40:26 +0200 Subject: [PATCH] Suppression des doublons --- avisstage/api.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/avisstage/api.py b/avisstage/api.py index 932d132..f2262c5 100644 --- a/avisstage/api.py +++ b/avisstage/api.py @@ -42,6 +42,10 @@ class LieuResource(ModelResource): return orm_filters + # Custom apply filters pour ajouter le "distinct" + def apply_filters(self, request, applicable_filters): + return self.get_object_list(request).filter(**applicable_filters).distinct() + # Ajout d'informations def dehydrate(self, bundle): bundle = super(LieuResource, self).dehydrate(bundle)