Merge branch 'feature/remove-presentation-crunches' into 'develop'
Remove all crunches from projects See merge request gm/gm-backend!100
This commit is contained in:
commit
19fb746356
|
|
@ -70,9 +70,6 @@ class CarouselListView(generics.ListAPIView):
|
|||
|
||||
def get_queryset(self):
|
||||
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()
|
||||
if country_code:
|
||||
qs = qs.by_country_code(country_code)
|
||||
|
|
|
|||
|
|
@ -54,18 +54,3 @@ class TagsFilterSet(TagsBaseFilterSet):
|
|||
|
||||
model = models.Tag
|
||||
fields = ('type',)
|
||||
|
||||
|
||||
# TMP TODO remove it later
|
||||
# Временный хардкод для демонстрации 4 ноября, потом удалить!
|
||||
def filter_by_type(self, queryset, name, value):
|
||||
""" Overrides base filter. Temporary decision"""
|
||||
if not (settings.NEWS_CHOSEN_TAGS and settings.ESTABLISHMENT_CHOSEN_TAGS):
|
||||
return super().filter_by_type(queryset, name, value)
|
||||
queryset = models.Tag.objects
|
||||
if self.NEWS in value:
|
||||
queryset = queryset.for_news().filter(value__in=settings.NEWS_CHOSEN_TAGS).distinct('value')
|
||||
if self.ESTABLISHMENT in value:
|
||||
queryset = queryset.for_establishments().filter(value__in=settings.ESTABLISHMENT_CHOSEN_TAGS).distinct(
|
||||
'value')
|
||||
return queryset
|
||||
|
|
@ -23,23 +23,6 @@ class ChosenTagsView(generics.ListAPIView, viewsets.GenericViewSet):
|
|||
.filter(id__in=result_tags_ids) \
|
||||
.order_by_priority()
|
||||
|
||||
def list(self, request, *args, **kwargs):
|
||||
# TMP TODO remove it later
|
||||
# Временный хардкод для демонстрации 4 ноября, потом удалить!
|
||||
queryset = self.filter_queryset(self.get_queryset())
|
||||
|
||||
page = self.paginate_queryset(queryset)
|
||||
if page is not None:
|
||||
serializer = self.get_serializer(page, many=True)
|
||||
return self.get_paginated_response(serializer.data)
|
||||
|
||||
serializer = self.get_serializer(queryset, many=True)
|
||||
result_list = serializer.data
|
||||
if request.query_params.get('type') and (settings.ESTABLISHMENT_CHOSEN_TAGS or settings.NEWS_CHOSEN_TAGS):
|
||||
ordered_list = settings.ESTABLISHMENT_CHOSEN_TAGS if request.query_params.get('type') == 'establishment' else settings.NEWS_CHOSEN_TAGS
|
||||
result_list = sorted(result_list, key=lambda x: ordered_list.index(x['index_name']))
|
||||
return Response(result_list)
|
||||
|
||||
|
||||
# User`s views & viewsets
|
||||
class TagCategoryViewSet(mixins.ListModelMixin, viewsets.GenericViewSet):
|
||||
|
|
|
|||
|
|
@ -490,9 +490,3 @@ PHONENUMBER_DB_FORMAT = 'NATIONAL'
|
|||
PHONENUMBER_DEFAULT_REGION = "FR"
|
||||
|
||||
FALLBACK_LOCALE = 'en-GB'
|
||||
|
||||
# TMP TODO remove it later
|
||||
# Временный хардкод для демонстрации 4 ноября, потом удалить!
|
||||
CAROUSEL_ITEMS = [230, 231, 232]
|
||||
ESTABLISHMENT_CHOSEN_TAGS = ['gastronomic', 'en_vogue', 'terrace', 'streetfood', 'business', 'bar_cocktail', 'brunch', 'pop']
|
||||
NEWS_CHOSEN_TAGS = ['eat', 'drink', 'cook', 'style', 'international', 'event', 'partnership']
|
||||
|
|
@ -38,10 +38,6 @@ sentry_sdk.init(
|
|||
integrations=[DjangoIntegration()]
|
||||
)
|
||||
|
||||
# TMP ( TODO remove it later)
|
||||
# Временный хардкод для демонстрации 4 ноября, потом удалить!
|
||||
HARDCODED_INTERNATIONAL_NEWS_IDS = [1460, 1471, 1482, 1484, 1611, 1612]
|
||||
|
||||
# Database
|
||||
# https://docs.djangoproject.com/en/2.2/ref/settings/#databases
|
||||
|
||||
|
|
|
|||
|
|
@ -40,10 +40,6 @@ sentry_sdk.init(
|
|||
integrations=[DjangoIntegration()]
|
||||
)
|
||||
|
||||
# TMP ( TODO remove it later)
|
||||
# Временный хардкод для демонстрации 4 ноября, потом удалить!
|
||||
HARDCODED_INTERNATIONAL_NEWS_IDS = [1460, 1471, 1482, 1484, 1611, 1612]
|
||||
|
||||
# Database
|
||||
# https://docs.djangoproject.com/en/2.2/ref/settings/#databases
|
||||
|
||||
|
|
|
|||
|
|
@ -26,8 +26,3 @@ ELASTICSEARCH_INDEX_NAMES = {
|
|||
# 'search_indexes.documents.news': 'stage_news', #temporarily disabled
|
||||
'search_indexes.documents.establishment': 'stage_establishment',
|
||||
}
|
||||
|
||||
|
||||
# TMP ( TODO remove it later)
|
||||
# Временный хардкод для демонстрации 4 ноября, потом удалить!
|
||||
HARDCODED_INTERNATIONAL_NEWS_IDS = [1460, 1471, 1482, 1484, 1611, 1612]
|
||||
Loading…
Reference in New Issue
Block a user