Hardcode for presentation
This commit is contained in:
parent
f1d22c2392
commit
9d087b53ee
|
|
@ -1,5 +1,6 @@
|
||||||
"""Main app views."""
|
"""Main app views."""
|
||||||
from django.http import Http404
|
from django.http import Http404
|
||||||
|
from django.conf import settings
|
||||||
from rest_framework import generics, permissions
|
from rest_framework import generics, permissions
|
||||||
from rest_framework.response import Response
|
from rest_framework.response import Response
|
||||||
|
|
||||||
|
|
@ -69,6 +70,9 @@ class CarouselListView(generics.ListAPIView):
|
||||||
|
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
country_code = self.request.country_code
|
country_code = self.request.country_code
|
||||||
|
if hasattr(settings, 'CAROUSEL_ITEMS') and country_code in ['www', 'main']:
|
||||||
|
qs = models.Carousel.objects.filter(id__in=settings.CAROUSEL_ITEMS)
|
||||||
|
return qs
|
||||||
qs = models.Carousel.objects.is_parsed().active()
|
qs = models.Carousel.objects.is_parsed().active()
|
||||||
if country_code:
|
if country_code:
|
||||||
qs = qs.by_country_code(country_code)
|
qs = qs.by_country_code(country_code)
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ class NewsMixinView:
|
||||||
# (по договорённости с заказчиком на демонстрации 4 ноября
|
# (по договорённости с заказчиком на демонстрации 4 ноября
|
||||||
# здесь будет 6 фиксированных новостей)
|
# здесь будет 6 фиксированных новостей)
|
||||||
# TODO replace this stub with actual logic
|
# TODO replace this stub with actual logic
|
||||||
if hasattr(settings, 'HARDCODED_INTERNATIONAL_NEWS_IDS'):
|
if hasattr(settings, 'HARDCODED_INTERNATIONAL_NEWS_IDS') and kwargs.get('hardcoded_only', False):
|
||||||
if country_code and country_code != 'www' and country_code != 'main':
|
if country_code and country_code != 'www' and country_code != 'main':
|
||||||
qs = qs.by_country_code(country_code)
|
qs = qs.by_country_code(country_code)
|
||||||
else:
|
else:
|
||||||
|
|
@ -51,6 +51,10 @@ class NewsListView(NewsMixinView, generics.ListAPIView):
|
||||||
serializer_class = serializers.NewsListSerializer
|
serializer_class = serializers.NewsListSerializer
|
||||||
filter_class = filters.NewsListFilterSet
|
filter_class = filters.NewsListFilterSet
|
||||||
|
|
||||||
|
def get_queryset(self, *args, **kwargs):
|
||||||
|
kwargs.update({'hardcoded_only': True})
|
||||||
|
super().get_queryset(*args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
class NewsDetailView(NewsMixinView, generics.RetrieveAPIView):
|
class NewsDetailView(NewsMixinView, generics.RetrieveAPIView):
|
||||||
"""News detail view."""
|
"""News detail view."""
|
||||||
|
|
|
||||||
|
|
@ -493,5 +493,6 @@ FALLBACK_LOCALE = 'en-GB'
|
||||||
|
|
||||||
# TMP TODO remove it later
|
# TMP TODO remove it later
|
||||||
# Временный хардкод для демонстрации 4 ноября, потом удалить!
|
# Временный хардкод для демонстрации 4 ноября, потом удалить!
|
||||||
|
CAROUSEL_ITEMS = [230, 231, 232]
|
||||||
ESTABLISHMENT_CHOSEN_TAGS = ['gastronomic', 'en_vogue', 'terrace', 'streetfood', 'business', 'bar_cocktail', 'brunch', 'pop']
|
ESTABLISHMENT_CHOSEN_TAGS = ['gastronomic', 'en_vogue', 'terrace', 'streetfood', 'business', 'bar_cocktail', 'brunch', 'pop']
|
||||||
NEWS_CHOSEN_TAGS = ['eat', 'drink', 'cook', 'style', 'international', 'event', 'partnership']
|
NEWS_CHOSEN_TAGS = ['eat', 'drink', 'cook', 'style', 'international', 'event', 'partnership']
|
||||||
Loading…
Reference in New Issue
Block a user