X-Git-Url: http://git.ithinksw.org/philo.git/blobdiff_plain/ac8a325857c260750e651281ef379d108db9ff17..7ebd19fad0a3feffc6ed3c3917799c26aaa223d3:/philo/contrib/shipherd/models.py diff --git a/philo/contrib/shipherd/models.py b/philo/contrib/shipherd/models.py index 429faaa..de9a869 100644 --- a/philo/contrib/shipherd/models.py +++ b/philo/contrib/shipherd/models.py @@ -163,12 +163,12 @@ class NavigationManager(models.Manager): # A distinct query is not strictly necessary. TODO: benchmark the efficiency # with/without distinct. - targets = list(Node.objects.filter(pk__in=target_pks).distinct()) + targets = dict([(n.pk, n) for n in Node.objects.filter(pk__in=target_pks).distinct()]) for cache in caches: for item in cache['items']: if item.target_node_id: - item.target_node = targets[targets.index(item.target_node)] + item.target_node = targets[item.target_node_id] def clear_cache(self): """Clears the manager's entire navigation cache."""