From: olivier <> Date: Tue, 16 Feb 2010 01:19:33 +0000 (+0000) Subject: fix enriched items query set when the location belongs to several country X-Git-Tag: 1.1~524 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=bf4fc45bc0c3f415ba74454c2f4532a9b80f9f9c;p=telemeta.git fix enriched items query set when the location belongs to several country --- diff --git a/telemeta/models/query.py b/telemeta/models/query.py index 0ee7fedc..23cb5594 100644 --- a/telemeta/models/query.py +++ b/telemeta/models/query.py @@ -147,7 +147,7 @@ class MediaItemQuerySet(CoreQuerySet): 'locations.name, ' '(SELECT l2.name FROM location_relations AS r INNER JOIN locations AS l2 ' 'ON r.ancestor_location_id = l2.id ' - 'WHERE r.location_id = media_items.location_id AND l2.type = ' + str(Location.COUNTRY) + ' ))' + 'WHERE r.location_id = media_items.location_id AND l2.type = ' + str(Location.COUNTRY) + ' LIMIT 1))' }) else: raise Exception("Unsupported virtual field: %s" % f)