Changed the ballot_icon template tag to use an already found ballot if available, rather than doing lookups to find it (twice!).

- Legacy-Id: 15007
This commit is contained in:
Henrik Levkowetz 2018-04-04 17:12:08 +00:00
parent 1ec98fdd59
commit 15d45b4d22

View file

@ -73,7 +73,8 @@ def ballot_icon(context, doc):
if not showballoticon(doc):
return ""
ballot = doc.active_ballot()
ballot = doc.ballot if hasattr(doc, 'ballot') else doc.active_ballot()
if not ballot:
return ""
@ -86,7 +87,7 @@ def ballot_icon(context, doc):
else:
return (1, pos.pos.order)
positions = list(doc.active_ballot().active_ad_positions().items())
positions = list(ballot.active_ad_positions().items())
positions.sort(key=sort_key)
right_click_string = ''