@@ -137,7 +137,7 @@ def interesting_doc_relations(doc):
137137 interesting_relations_that = cls .objects .filter (target__docs = target , relationship__in = that_relationships ).select_related ('source' )
138138 interesting_relations_that_doc = cls .objects .filter (source = doc , relationship__in = that_doc_relationships ).prefetch_related ('target__docs' )
139139
140- return list ( interesting_relations_that ), list ( interesting_relations_that_doc )
140+ return interesting_relations_that , interesting_relations_that_doc
141141
142142def document_main (request , name , rev = None ):
143143 doc = get_object_or_404 (Document .objects .select_related (), docalias__name = name )
@@ -347,9 +347,9 @@ def document_main(request, name, rev=None):
347347 search_archive = quote (search_archive , safe = "~" )
348348
349349 # conflict reviews
350- conflict_reviews = [r .source .name for r in interesting_relations_that if r . relationship == "conflrev" ]
350+ conflict_reviews = [r .source .name for r in interesting_relations_that . filter ( relationship = "conflrev" ) ]
351351
352- status_change_docs = [ r for r in interesting_relations_that if r . relationship_id in STATUSCHANGE_RELATIONS ]
352+ status_change_docs = interesting_relations_that . filter ( relationship__in = STATUSCHANGE_RELATIONS )
353353 status_changes = [ r .source for r in status_change_docs if r .source .get_state_slug () in ('appr-sent' ,'appr-pend' )]
354354 proposed_status_changes = [ r .source for r in status_change_docs if r .source .get_state_slug () in ('needshep' ,'adrev' ,'iesgeval' ,'defer' ,'appr-pr' )]
355355
@@ -473,14 +473,14 @@ def document_main(request, name, rev=None):
473473 submission = submission ,
474474 resurrected_by = resurrected_by ,
475475
476- replaces = [ r for r in interesting_relations_that_doc if r . relationship == "replaces" ] ,
477- replaced_by = [ r for r in interesting_relations_that if r . relationship == "replaces" ] ,
478- possibly_replaces = [ r for r in interesting_relations_that_doc if r . relationship == "possibly_replaces" ] ,
479- possibly_replaced_by = [ r for r in interesting_relations_that if r . relationship == "possibly_replaces" ] ,
480- updates = [ r for r in interesting_relations_that_doc if r . relationship == "updates" ] ,
481- updated_by = [ r for r in interesting_relations_that if r . relationship == "updates" ] ,
482- obsoletes = [ r for r in interesting_relations_that_doc if r . relationship == "obs" ] ,
483- obsoleted_by = [ r for r in interesting_relations_that if r . relationship == "obs" ] ,
476+ replaces = interesting_relations_that_doc . filter ( relationship = "replaces" ) ,
477+ replaced_by = interesting_relations_that . filter ( relationship = "replaces" ) ,
478+ possibly_replaces = interesting_relations_that_doc . filter ( relationship = "possibly_replaces" ) ,
479+ possibly_replaced_by = interesting_relations_that . filter ( relationship = "possibly_replaces" ) ,
480+ updates = interesting_relations_that_doc . filter ( relationship = "updates" ) ,
481+ updated_by = interesting_relations_that . filter ( relationship = "updates" ) ,
482+ obsoletes = interesting_relations_that_doc . filter ( relationship = "obs" ) ,
483+ obsoleted_by = interesting_relations_that . filter ( relationship = "obs" ) ,
484484 conflict_reviews = conflict_reviews ,
485485 status_changes = status_changes ,
486486 proposed_status_changes = proposed_status_changes ,
0 commit comments