]> git.openstreetmap.org Git - osqa.git/blobdiff - forum/models/tag.py
resolves an issue with tags used count that can get out of control if called from...
[osqa.git] / forum / models / tag.py
index 73b1e30a2a92f3dcee60b85671cfdb91f7c1e3ac..791636fa0a9810f2dee4c935d8bc5304d64d9bf0 100644 (file)
@@ -32,10 +32,12 @@ class Tag(BaseModel):
         return force_unicode(self.name)
 
     def add_to_usage_count(self, value):
-        if self.used_count + value < 0:
+        if int(self.used_count + value) < 0:
             self.used_count = 0
         else:
-            self.used_count = models.F('used_count') + value
+            self.used_count += value
+
+        self.save()
 
     def cache_key(self):
         return self._generate_cache_key(Tag.safe_cache_name(self.name))