Skip to content

Commit 3cd0304

Browse files
committed
Added couple of select_related's to reduce SQL queries for per-doc page
- Legacy-Id: 1918
1 parent c4aea57 commit 3cd0304

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

ietf/idrfc/idrfc_wrapper.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -546,14 +546,14 @@ def _init(self):
546546
ads = set()
547547

548548
positions = []
549-
for p in self.ballot.positions.all():
549+
for p in self.ballot.positions.all().select_related('ad'):
550550
po = create_position_object(self.ballot, p)
551551
#if not self.ballot_active:
552552
# if 'is_old_ad' in po:
553553
# del po['is_old_ad']
554554
ads.add(str(p.ad))
555555
positions.append(po)
556-
for c in self.ballot.comments.all():
556+
for c in self.ballot.comments.all().select_related('ad'):
557557
if (str(c.ad) not in ads) and c.ad.is_current_ad():
558558
positions.append({'has_text':True,
559559
'comment_text':c.text,

0 commit comments

Comments
 (0)