Merge remote-tracking branch 'origin/origin/migration_fix' into migration_fix

This commit is contained in:
alex 2019-10-29 21:57:07 +03:00
commit a0c52d8ef9
4 changed files with 75 additions and 75 deletions

View File

@ -438,7 +438,7 @@ class Establishment(ProjectBaseMixin, URLImageMixin, TranslatedFieldsMixin):
@property @property
def works_now(self): def works_now(self):
""" Is establishment working now """ """ Is establishment working now """
now_at_est_tz = datetime.now(tz=ptz(self.tz)) now_at_est_tz = datetime.now(tz=self.tz)
current_week = now_at_est_tz.weekday() current_week = now_at_est_tz.weekday()
schedule_for_today = self.schedule.filter(weekday=current_week).first() schedule_for_today = self.schedule.filter(weekday=current_week).first()
if schedule_for_today is None or schedule_for_today.closed_at is None or schedule_for_today.opening_at is None: if schedule_for_today is None or schedule_for_today.closed_at is None or schedule_for_today.opening_at is None:

View File

@ -1 +1 @@
# from search_indexes.signals import update_document from search_indexes.signals import update_document

View File

@ -4,74 +4,74 @@ from django.dispatch import receiver
from django_elasticsearch_dsl.registries import registry from django_elasticsearch_dsl.registries import registry
# @receiver(post_save) @receiver(post_save)
# def update_document(sender, **kwargs): def update_document(sender, **kwargs):
# from establishment.models import Establishment from establishment.models import Establishment
# app_label = sender._meta.app_label app_label = sender._meta.app_label
# model_name = sender._meta.model_name model_name = sender._meta.model_name
# instance = kwargs['instance'] instance = kwargs['instance']
#
# if app_label == 'location': if app_label == 'location':
# if model_name == 'country': if model_name == 'country':
# establishments = Establishment.objects.filter( establishments = Establishment.objects.filter(
# address__city__country=instance) address__city__country=instance)
# for establishment in establishments: for establishment in establishments:
# registry.update(establishment) registry.update(establishment)
# if model_name == 'city': if model_name == 'city':
# establishments = Establishment.objects.filter( establishments = Establishment.objects.filter(
# address__city=instance) address__city=instance)
# for establishment in establishments: for establishment in establishments:
# registry.update(establishment) registry.update(establishment)
# if model_name == 'address': if model_name == 'address':
# establishments = Establishment.objects.filter( establishments = Establishment.objects.filter(
# address=instance) address=instance)
# for establishment in establishments: for establishment in establishments:
# registry.update(establishment) registry.update(establishment)
#
# if app_label == 'establishment': if app_label == 'establishment':
# # todo: remove after migration # todo: remove after migration
# from establishment import models as establishment_models from establishment import models as establishment_models
# if model_name == 'establishmenttype': if model_name == 'establishmenttype':
# if isinstance(instance, establishment_models.EstablishmentType): if isinstance(instance, establishment_models.EstablishmentType):
# establishments = Establishment.objects.filter( establishments = Establishment.objects.filter(
# establishment_type=instance) establishment_type=instance)
# for establishment in establishments: for establishment in establishments:
# registry.update(establishment) registry.update(establishment)
# if model_name == 'establishmentsubtype': if model_name == 'establishmentsubtype':
# if isinstance(instance, establishment_models.EstablishmentSubType): if isinstance(instance, establishment_models.EstablishmentSubType):
# establishments = Establishment.objects.filter( establishments = Establishment.objects.filter(
# establishment_subtypes=instance) establishment_subtypes=instance)
# for establishment in establishments: for establishment in establishments:
# registry.update(establishment) registry.update(establishment)
#
# if app_label == 'tag': if app_label == 'tag':
# if model_name == 'tag': if model_name == 'tag':
# establishments = Establishment.objects.filter(tags=instance) establishments = Establishment.objects.filter(tags=instance)
# for establishment in establishments: for establishment in establishments:
# registry.update(establishment) registry.update(establishment)
#
#
# @receiver(post_save) @receiver(post_save)
# def update_news(sender, **kwargs): def update_news(sender, **kwargs):
# from news.models import News from news.models import News
# app_label = sender._meta.app_label app_label = sender._meta.app_label
# model_name = sender._meta.model_name model_name = sender._meta.model_name
# instance = kwargs['instance'] instance = kwargs['instance']
#
# if app_label == 'location': if app_label == 'location':
# if model_name == 'country': if model_name == 'country':
# qs = News.objects.filter(country=instance) qs = News.objects.filter(country=instance)
# for news in qs: for news in qs:
# registry.update(news) registry.update(news)
#
# if app_label == 'news': if app_label == 'news':
# if model_name == 'newstype': if model_name == 'newstype':
# qs = News.objects.filter(news_type=instance) qs = News.objects.filter(news_type=instance)
# for news in qs: for news in qs:
# registry.update(news) registry.update(news)
#
# if app_label == 'tag': if app_label == 'tag':
# if model_name == 'tag': if model_name == 'tag':
# qs = News.objects.filter(tags=instance) qs = News.objects.filter(tags=instance)
# for news in qs: for news in qs:
# registry.update(news) registry.update(news)

View File

@ -26,8 +26,8 @@ ELASTICSEARCH_DSL = {
ELASTICSEARCH_INDEX_NAMES = { ELASTICSEARCH_INDEX_NAMES = {
# 'search_indexes.documents.news': 'development_news', # temporarily disabled 'search_indexes.documents.news': 'development_news', # temporarily disabled
# 'search_indexes.documents.establishment': 'development_establishment', 'search_indexes.documents.establishment': 'development_establishment',
} }