--- a/web/hdabo/management/commands/import_tag_popularity.py Fri Jul 08 16:34:01 2011 +0200
+++ b/web/hdabo/management/commands/import_tag_popularity.py Fri Jul 08 18:13:36 2011 +0200
@@ -10,6 +10,7 @@
from django.core.management.base import BaseCommand, CommandError
from hdabo.models import Tag
+from hdabo.utils import normalize
from optparse import make_option
import csv
import math
@@ -128,11 +129,10 @@
row = dict([(safe_decode(key, self.encoding), safe_decode(value, self.encoding)) for key, value in row.items()])
- label = row['label'].strip()
+ label = normalize(row['label'].strip())
if not label:
continue
-
- for tag in Tag.objects.filter(label__iexact=label):
+ for tag in Tag.objects.filter(normalized_label__icontains=label):
tag.popularity = int(row['popularity'])
tag.save()