else:
return super(ActionQuerySet, self).obj_from_datadict(datadict)
- def get(self, *args, **kwargs):
- return super(ActionQuerySet, self).get(*args, **kwargs).leaf()
+ def get(self, *args, **kwargs):
+ action = super(ActionQuerySet, self).get(*args, **kwargs).leaf()
+
+ if not isinstance(action, self.model):
+ raise self.model.DoesNotExist()
+
+ return action
class ActionManager(CachedManager):
use_for_related_fields = True
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