+ node = super(NodeQuerySet, self).get(*args, **kwargs).leaf
+
+ if not isinstance(node, self.model):
+ raise self.model.DoesNotExist()
+
+ return node
+
+ def any_state(self, *args):
+ filter = None
+
+ for s in args:
+ s_filter = models.Q(state_string__contains="(%s)" % s)
+ filter = filter and (filter | s_filter) or s_filter
+
+ if filter:
+ return self.filter(filter)
+ else:
+ return self
+
+ def all_states(self, *args):
+ filter = None
+
+ for s in args:
+ s_filter = models.Q(state_string__contains="(%s)" % s)
+ filter = filter and (filter & s_filter) or s_filter
+
+ if filter:
+ return self.filter(filter)
+ else:
+ return self