[PATCH 3/5] views: Resolve select_related issues
Stephen Finucane
stephen at that.guru
Mon Oct 10 09:26:40 AEDT 2016
Django 1.10 prohibits non-relational fields for nested relations [1].
Replace said call with a functional alternative.
[1] https://docs.djangoproject.com/en/dev/releases/1.10/#select-related-prohibits-non-relational-fields-for-nested-relations
Signed-off-by: Stephen Finucane <stephen at that.guru>
---
patchwork/views/rest_api.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/patchwork/views/rest_api.py b/patchwork/views/rest_api.py
index d412587..9c58669 100644
--- a/patchwork/views/rest_api.py
+++ b/patchwork/views/rest_api.py
@@ -94,7 +94,7 @@ class PeopleViewSet(PatchworkViewSet):
def get_queryset(self):
qs = super(PeopleViewSet, self).get_queryset()
- return qs.select_related('user__username')
+ return qs.prefetch_related('user')
class ProjectViewSet(PatchworkViewSet):
--
2.7.4
More information about the Patchwork
mailing list