Commit 7a2a711
Fix N+1 query issue in Grant admin invitation letter flag
Use Django''s Exists annotation in get_queryset() instead of calling
has_invitation_letter_request() method for each grant in the admin list.
This optimizes the query to use a single SQL query with EXISTS subquery
rather than individual queries for each grant row.
Co-authored-by: Marco Acierno <marcoacierno@users.noreply.github.com>1 parent d04086a commit 7a2a711
2 files changed
Lines changed: 9 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
588 | 588 | | |
589 | 589 | | |
590 | 590 | | |
591 | | - | |
| 591 | + | |
592 | 592 | | |
593 | 593 | | |
| 594 | + | |
| 595 | + | |
594 | 596 | | |
595 | 597 | | |
596 | 598 | | |
| |||
614 | 616 | | |
615 | 617 | | |
616 | 618 | | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
617 | 625 | | |
618 | 626 | | |
619 | 627 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
333 | 333 | | |
334 | 334 | | |
335 | 335 | | |
336 | | - | |
337 | | - | |
338 | | - | |
339 | | - | |
340 | | - | |
341 | | - | |
342 | | - | |
343 | | - | |
344 | | - | |
345 | | - | |
346 | 336 | | |
347 | 337 | | |
348 | 338 | | |
| |||
0 commit comments