]> git.openstreetmap.org Git - osqa.git/blobdiff - forum/models/node.py
Adds a positional style for the announcement bar.
[osqa.git] / forum / models / node.py
index bebd07c6cd4df75b57c06f446001f79e1bb3e2ce..75b39339e3284d74e913f60d99e80fa35a7b8d21 100644 (file)
@@ -95,7 +95,12 @@ class NodeQuerySet(CachedQuerySet):
             return super(NodeQuerySet, self).obj_from_datadict(datadict)
 
     def get(self, *args, **kwargs):
-        return super(NodeQuerySet, self).get(*args, **kwargs).leaf
+        node = super(NodeQuerySet, self).get(*args, **kwargs).leaf
+
+        if not isinstance(node, self.model):
+            raise self.model.DoesNotExist()
+
+        return node
 
     def filter_state(self, **kwargs):
         apply_bool = lambda q, b: b and q or ~q
@@ -349,7 +354,7 @@ class Node(BaseModel, NodeContent):
 
         if action:
             for tag in self.tags.all():
-                tag.tag.add_to_usage_count(-1)
+                tag.add_to_usage_count(-1)
                 tag.save()
         else:
             for tag in Tag.objects.filter(name__in=self.tagname_list()):