]> git.parisson.com Git - telemeta.git/commitdiff
fix enriched items query set when the location belongs to several country
authorolivier <>
Tue, 16 Feb 2010 01:19:33 +0000 (01:19 +0000)
committerolivier <>
Tue, 16 Feb 2010 01:19:33 +0000 (01:19 +0000)
telemeta/models/query.py

index 0ee7fedc5c9a31f3aa1aa4472e26ef4a2c6b5c01..23cb55944103caca33de0d3438bd254bffb07d8d 100644 (file)
@@ -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)