disable news_type update post save

This commit is contained in:
Kuroshini 2020-01-22 20:52:15 +03:00
parent 407f9026e0
commit e94dd03875
3 changed files with 25 additions and 28 deletions

View File

@ -36,14 +36,11 @@ def update_news(sender, **kwargs):
instance = kwargs['instance']
app_label_model_name_to_filter = {
('location', 'country'): 'country',
('news', 'newstype'): 'news_type',
# ('news', 'newstype'): 'news_type',
('tag', 'tag'): 'tags',
}
filter_name = app_label_model_name_to_filter.get((app_label, model_name))
if filter_name:
if filter_name == 'news_type':
registry.update_related(instance)
return
qs = News.objects.filter(**{filter_name: instance})
for product in qs:
registry.update(product)

View File

@ -5,9 +5,9 @@ from .base import MEDIA_LOCATION
# AMAZON S3
AWS_S3_REGION_NAME = 'eu-central-1'
AWS_ACCESS_KEY_ID = os.getenv('AWS_ACCESS_KEY_ID')
AWS_SECRET_ACCESS_KEY = os.getenv('AWS_SECRET_ACCESS_KEY')
AWS_STORAGE_BUCKET_NAME = os.getenv('AWS_STORAGE_BUCKET_NAME')
AWS_ACCESS_KEY_ID = 'AKIA4T5M5TJWDYT3SB6Y'
AWS_SECRET_ACCESS_KEY = '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'
AWS_STORAGE_BUCKET_NAME = 'gm-test.com'
AWS_S3_CUSTOM_DOMAIN = f's3.{AWS_S3_REGION_NAME}.amazonaws.com/{AWS_STORAGE_BUCKET_NAME}'
AWS_S3_OBJECT_PARAMETERS = {'CacheControl': 'max-age=86400'}
AWS_S3_ADDRESSING_STYLE = 'path'

View File

@ -1,7 +1,7 @@
"""Local settings."""
from .base import *
import sys
# from .amazon_s3 import *
from .amazon_s3 import *
ALLOWED_HOSTS = ['*', ]
@ -28,7 +28,7 @@ MEDIA_ROOT = os.path.join(PUBLIC_ROOT, MEDIA_LOCATION)
# SORL thumbnails
THUMBNAIL_DEBUG = True
MIDDLEWARE.append('utils.middleware.log_db_queries_per_API_request')
# DATABASES
DATABASES = {
@ -43,15 +43,15 @@ DATABASES = {
'options': '-c search_path=gm,public'
},
},
'legacy': {
'ENGINE': 'django.db.backends.mysql',
# 'HOST': '172.22.0.1',
'HOST': 'mysql_db',
'PORT': 3306,
'NAME': 'dev',
'USER': 'dev',
'PASSWORD': 'octosecret123'
},
# 'legacy': {
# 'ENGINE': 'django.db.backends.mysql',
# # 'HOST': '172.22.0.1',
# 'HOST': 'mysql_db',
# 'PORT': 3306,
# 'NAME': 'dev',
# 'USER': 'dev',
# 'PASSWORD': 'octosecret123'
# },
}
@ -84,26 +84,26 @@ LOGGING = {
'py.warnings': {
'handlers': ['console'],
},
# 'django.db.backends': {
# 'handlers': ['console', ],
# 'level': 'DEBUG',
# 'propagate': False,
# },
'django.db.backends': {
'handlers': ['console', ],
'level': 'DEBUG',
'propagate': False,
},
}
}
# ELASTICSEARCH SETTINGS
ELASTICSEARCH_DSL = {
'default': {
'hosts': 'elasticsearch:9200'
'hosts': '188.68.209.124:9200'
}
}
ELASTICSEARCH_INDEX_NAMES = {
# 'search_indexes.documents.news': 'local_news',
'search_indexes.documents.establishment': 'local_establishment',
'search_indexes.documents.product': 'local_product',
'search_indexes.documents.tag_category': 'local_tag_category',
'search_indexes.documents.news': 'development_news',
'search_indexes.documents.establishment': 'development_establishment',
'search_indexes.documents.product': 'development_product',
'search_indexes.documents.tag_category': 'development_tag_category',
}
ELASTICSEARCH_DSL_AUTOSYNC = False