From dd18dceb6daa33741aa1d2cbf683518eff46a772 Mon Sep 17 00:00:00 2001 From: VladislavOstapov Date: Mon, 1 May 2023 16:50:54 +0300 Subject: [PATCH] =?UTF-8?q?=D0=BF=D0=BE=D1=87=D0=B8=D0=BD=D0=B8=D0=BB=20?= =?UTF-8?q?=D0=BF=D0=BE=D0=BB=D1=83=D1=87=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=B0?= =?UTF-8?q?=D0=B2=D0=B0=D1=82=D0=B0=D1=80=D0=BA=D0=B8=20=D1=8E=D0=B7=D0=B5?= =?UTF-8?q?=D1=80=D0=B0=20=D0=B2=20=D0=BC=D0=B5=D1=82=D0=BE=D0=B4=D0=B5=20?= =?UTF-8?q?=D0=BF=D0=BE=D0=BB=D1=83=D1=87=D0=B5=D0=BD=D0=B8=D1=8F=20=D1=8E?= =?UTF-8?q?=D0=B7=D0=B5=D1=80=D0=B0=20=D0=BF=D0=BE=20id?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/models.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/api/models.py b/api/models.py index 7dcd7f2..e59c2ce 100755 --- a/api/models.py +++ b/api/models.py @@ -68,7 +68,13 @@ class Account(models.Model): raise Exception(API_ERROR_NOT_FOUND, "user") async def get_by_id(self, user_id: int): - u = Account.objects.filter(id=user_id).select_related('executoraccount', 'accountavatar') + related = [ + 'executoraccount', + 'accountavatar', + 'accountavatar__photo', + 'accountavatar__profile_background' + ] + u = Account.objects.filter(id=user_id).select_related(*related) if self.role == Account.ROLE_EXECUTOR or self.role == Account.ROLE_CUSTOMER: u.filter(role__in=[Account.ROLE_EXECUTOR, Account.ROLE_CUSTOMER])