大幅优化数据库查询, 升级django至1.11 LTS, 升级python至3.6.2

This commit is contained in:
zema1
2017-08-29 19:26:38 +08:00
parent 539b45148b
commit 1e4ede6d1a
13 changed files with 57 additions and 33 deletions

View File

@@ -47,7 +47,7 @@ class UserProfileAPI(APIView):
user = request.user
except User.DoesNotExist:
return self.error("User does not exist")
profile = UserProfile.objects.get(user=user)
profile = UserProfile.objects.select_related("user").get(user=user)
return self.success(UserProfileSerializer(profile).data)
@validate_serializer(EditUserProfileSerializer)