Skip to content

Commit 27fbac2

Browse files
committed
Fetch ancestors outside of loop
1 parent 46c1fcf commit 27fbac2

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

cbv/views.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,14 @@ def get_context_data(self, **kwargs):
7070
klass.module.project_version, klass.module, klass
7171
)
7272
direct_ancestors = list(klass.get_ancestors())
73+
all_ancestors = klass.get_all_ancestors()
7374
ancestors = [
7475
self.Ancestor(
7576
name=ancestor.name,
7677
url=ancestor.get_absolute_url(),
7778
is_direct=ancestor in direct_ancestors,
7879
)
79-
for ancestor in klass.get_all_ancestors()
80+
for ancestor in all_ancestors
8081
]
8182
children = [
8283
self.Child(

0 commit comments

Comments
 (0)