Fix
This commit is contained in:
commit
a93a2ccc6a
|
|
@ -15,13 +15,23 @@ class NewsMixinView:
|
||||||
"""News mixin."""
|
"""News mixin."""
|
||||||
|
|
||||||
permission_classes = (permissions.AllowAny,)
|
permission_classes = (permissions.AllowAny,)
|
||||||
|
serializer_class = serializers.NewsBaseSerializer
|
||||||
|
|
||||||
def get_queryset(self, *args, **kwargs):
|
def get_queryset(self, *args, **kwargs):
|
||||||
|
from django.conf import settings
|
||||||
"""Override get_queryset method."""
|
"""Override get_queryset method."""
|
||||||
qs = models.News.objects.published().with_base_related() \
|
qs = models.News.objects.published().with_base_related() \
|
||||||
.order_by('-is_highlighted', '-created')
|
.order_by('-is_highlighted', '-created')
|
||||||
if self.request.country_code:
|
country_code = self.request.country_code
|
||||||
qs = qs.by_country_code(self.request.country_code)
|
if country_code and country_code != 'www' and country_code != 'main':
|
||||||
|
return qs.by_country_code(self.request.country_code)
|
||||||
|
else:
|
||||||
|
if settings.HARDCODED_INTERNATIONAL_NEWS_IDS:
|
||||||
|
# Temporary stub for international news logic
|
||||||
|
# (по договорённости с заказчиком на демонстрации 4 ноября здесь будет 6 фиксированных новостей)
|
||||||
|
# TODO replace this stub with actual logic
|
||||||
|
return models.News.objects.filter(id__in=settings.HARDCODED_INTERNATIONAL_NEWS_IDS)
|
||||||
|
else:
|
||||||
return qs
|
return qs
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,8 +42,6 @@ class NewsDocument(Document):
|
||||||
'slug',
|
'slug',
|
||||||
'state',
|
'state',
|
||||||
'is_highlighted',
|
'is_highlighted',
|
||||||
# 'image_url',
|
|
||||||
# 'preview_image_url',
|
|
||||||
'template',
|
'template',
|
||||||
)
|
)
|
||||||
related_models = [models.NewsType]
|
related_models = [models.NewsType]
|
||||||
|
|
|
||||||
|
|
@ -34,3 +34,7 @@ sentry_sdk.init(
|
||||||
dsn="https://35d9bb789677410ab84a822831c6314f@sentry.io/1729093",
|
dsn="https://35d9bb789677410ab84a822831c6314f@sentry.io/1729093",
|
||||||
integrations=[DjangoIntegration()]
|
integrations=[DjangoIntegration()]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# TMP ( TODO remove it later)
|
||||||
|
# Временный хардкод для демонстрации 4 ноября, потом удалить!
|
||||||
|
HARDCODED_INTERNATIONAL_NEWS_IDS = [8, 9, 10, 11, 15, 17]
|
||||||
|
|
|
||||||
|
|
@ -88,3 +88,8 @@ ELASTICSEARCH_INDEX_NAMES = {
|
||||||
TESTING = sys.argv[1:2] == ['test']
|
TESTING = sys.argv[1:2] == ['test']
|
||||||
if TESTING:
|
if TESTING:
|
||||||
ELASTICSEARCH_INDEX_NAMES = {}
|
ELASTICSEARCH_INDEX_NAMES = {}
|
||||||
|
|
||||||
|
|
||||||
|
# TMP ( TODO remove it later)
|
||||||
|
# Временный хардкод для демонстрации 4 ноября, потом удалить!
|
||||||
|
HARDCODED_INTERNATIONAL_NEWS_IDS = [8, 9, 10, 11, 15, 17]
|
||||||
|
|
@ -26,3 +26,8 @@ ELASTICSEARCH_INDEX_NAMES = {
|
||||||
# 'search_indexes.documents.news': 'stage_news', #temporarily disabled
|
# 'search_indexes.documents.news': 'stage_news', #temporarily disabled
|
||||||
'search_indexes.documents.establishment': 'stage_establishment',
|
'search_indexes.documents.establishment': 'stage_establishment',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# TMP ( TODO remove it later)
|
||||||
|
# Временный хардкод для демонстрации 4 ноября, потом удалить!
|
||||||
|
HARDCODED_INTERNATIONAL_NEWS_IDS = [8, 9, 10, 11, 15, 17]
|
||||||
Loading…
Reference in New Issue
Block a user