Commit 0b56c948b9d0ce0a3b069264d938d4e5b6fb2c4f
1 parent
0b6a759a6e
Exists in
master
Prefetching users to optimize the query
Showing 1 changed file with 1 additions and 1 deletions Side-by-side Diff
flashcards/management/commands/notifyusers.py
View file @
0b56c94
... | ... | @@ -8,7 +8,7 @@ |
8 | 8 | help = 'Notify the users if they have cards to be reviewed' |
9 | 9 | |
10 | 10 | def handle(self, *args, **options): |
11 | - notify_list = UserFlashcard.objects.filter( | |
11 | + notify_list = UserFlashcard.objects.prefetch_related('user').filter( | |
12 | 12 | next_review__lte=Now() |
13 | 13 | ).exclude( |
14 | 14 | user__registration_id=None, |