kopia lustrzana https://github.com/wagtail/wagtail
Prefetch wagtail_userprofile when retrieving comment authors
avatar_url will access this, so this prevents an N+1 query.pull/7236/head
rodzic
bca79b81f7
commit
ee8291d238
|
|
@ -887,7 +887,10 @@ class CommentPanel(EditHandler):
|
||||||
data['replies'] = replies
|
data['replies'] = replies
|
||||||
serialized_comments.append(data)
|
serialized_comments.append(data)
|
||||||
|
|
||||||
authors = {str(user.pk): user_data(user) for user in get_user_model().objects.filter(pk__in=user_pks)}
|
authors = {
|
||||||
|
str(user.pk): user_data(user)
|
||||||
|
for user in get_user_model().objects.filter(pk__in=user_pks).select_related('wagtail_userprofile')
|
||||||
|
}
|
||||||
|
|
||||||
comments_data = {
|
comments_data = {
|
||||||
'comments': serialized_comments,
|
'comments': serialized_comments,
|
||||||
|
|
|
||||||
Ładowanie…
Reference in New Issue