]> git.openstreetmap.org Git - osqa.git/blobdiff - forum/models/tag.py
listen for DoesNotExist exceptions when exporting user marked tags, use different...
[osqa.git] / forum / models / tag.py
index 791636fa0a9810f2dee4c935d8bc5304d64d9bf0..73b1e30a2a92f3dcee60b85671cfdb91f7c1e3ac 100644 (file)
@@ -32,12 +32,10 @@ class Tag(BaseModel):
         return force_unicode(self.name)
 
     def add_to_usage_count(self, value):
-        if int(self.used_count + value) < 0:
+        if self.used_count + value < 0:
             self.used_count = 0
         else:
-            self.used_count += value
-
-        self.save()
+            self.used_count = models.F('used_count') + value
 
     def cache_key(self):
         return self._generate_cache_key(Tag.safe_cache_name(self.name))