From 5cee5ed594d35c50826bae57c457b25687e7d66f Mon Sep 17 00:00:00 2001 From: olivier <> Date: Sun, 9 Mar 2008 22:55:56 +0000 Subject: [PATCH] fix search combining country/continent and ethnic group --- telemeta/models/query.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/telemeta/models/query.py b/telemeta/models/query.py index 8b0429fa..a9919c80 100644 --- a/telemeta/models/query.py +++ b/telemeta/models/query.py @@ -35,15 +35,11 @@ class MediaCollectionQuerySet(CoreQuerySet): def by_country(self, country): "Find collections by country" - return self.extra(where = ["id IN (SELECT collection_id " - "FROM telemeta_item WHERE etat = %s)"], - params=[country]); + return self.filter(items__etat=country).distinct() def by_continent(self, continent): "Find collections by continent" - return self.extra(where = ["id IN (SELECT collection_id " - "FROM telemeta_item WHERE continent = %s)"], - params=[continent]); + return self.filter(items__continent=continent).distinct() def by_recording_date(self, pattern): return self.filter(annee_enr__icontains=pattern) -- 2.39.5