diff -r d162cb0c4386 -r 46ad324f6fe4 src/hdalab/management/commands/query_geo_inclusion.py --- a/src/hdalab/management/commands/query_geo_inclusion.py Fri Nov 14 17:06:02 2014 +0100 +++ b/src/hdalab/management/commands/query_geo_inclusion.py Sun Nov 16 18:09:42 2014 +0100 @@ -17,6 +17,9 @@ def handle_noargs(self, **options): self.style = no_style() + GeoInclusion.objects.all().delete() + Country.objects.all().delete() + qs = Tag.objects.filter(category__label="Localisation").exclude(dbpedia_uri = None) total = qs.count() @@ -48,13 +51,13 @@ if re.match(resourceprefix, resourceuri): countrytxt = re.findall('([^/]+$)', resourceuri)[0] - country, created = Country.objects.get_or_create(dbpedia_uri=resourceuri) + country, _ = Country.objects.get_or_create(dbpedia_uri=resourceuri) GeoInclusion.objects.get_or_create(tag=tag, country=country) if resourceuri == identityuri: countrytxt = '' - country, created = Country.objects.get_or_create(dbpedia_uri=tag.dbpedia_uri) + country, _ = Country.objects.get_or_create(dbpedia_uri=tag.dbpedia_uri) GeoInclusion.objects.get_or_create(tag=tag, country=country) else: