From 37fb67cbb33b4179cff019236ff0aa70f710943c Mon Sep 17 00:00:00 2001 From: Kuroshini Date: Wed, 16 Oct 2019 14:11:07 +0300 Subject: [PATCH 1/3] Fix subqueries --- apps/main/models.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/main/models.py b/apps/main/models.py index 6af4e4d8..129ea238 100644 --- a/apps/main/models.py +++ b/apps/main/models.py @@ -173,7 +173,8 @@ class SiteSettings(ProjectBaseMixin): @property def published_sitefeatures(self): return self.sitefeature_set\ - .filter(Q(published=True) and Q(feature__source__in=[PlatformMixin.WEB, PlatformMixin.ALL])) + .filter(published=True)\ + .filter(feature__source__in=[PlatformMixin.WEB, PlatformMixin.ALL]) @property def site_url(self): From 2c9d579a54a71633bbca9b3037c69b5a787263fe Mon Sep 17 00:00:00 2001 From: "e.stoyushko" Date: Thu, 31 Oct 2019 11:42:57 +0000 Subject: [PATCH 2/3] Update models.py --- apps/main/models.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/main/models.py b/apps/main/models.py index 129ea238..1474acb0 100644 --- a/apps/main/models.py +++ b/apps/main/models.py @@ -172,9 +172,9 @@ class SiteSettings(ProjectBaseMixin): @property def published_sitefeatures(self): - return self.sitefeature_set\ - .filter(published=True)\ - .filter(feature__source__in=[PlatformMixin.WEB, PlatformMixin.ALL]) + return self.sitefeature_set. \ + filter(Q(published=True) & + Q(feature__source__in=[PlatformMixin.WEB, PlatformMixin.ALL])) @property def site_url(self): From 55e68ec336019c99bb8efe26afdf67c01837541a Mon Sep 17 00:00:00 2001 From: alex Date: Thu, 31 Oct 2019 17:19:07 +0300 Subject: [PATCH 3/3] fix establishment mark --- .../management/commands/add_establishment_mark.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/apps/establishment/management/commands/add_establishment_mark.py b/apps/establishment/management/commands/add_establishment_mark.py index 1588268f..11053339 100644 --- a/apps/establishment/management/commands/add_establishment_mark.py +++ b/apps/establishment/management/commands/add_establishment_mark.py @@ -1,5 +1,3 @@ -from pprint import pprint - from django.core.management.base import BaseCommand from django.db.models import Q @@ -19,8 +17,6 @@ class Command(BaseCommand): Q(mark__isnull=True) ).filter(aasm_state='published').values_list('establishment_id', 'mark', 'updated_at') - print(queryset.count()) - for es_id, new_mark, new_date in queryset: try: mark, date = valid_data[es_id] @@ -41,6 +37,5 @@ class Command(BaseCommand): establishment.public_mark = int(value[0]) establishment.save() count += 1 - break self.stdout.write(self.style.WARNING(f'Updated {count} objects.'))