thumbnail alias for images in news description

This commit is contained in:
a.gorbunov 2020-01-09 18:36:28 +03:00 committed by Kuroshini
parent 0672bcaef9
commit e70e1d0a67
3 changed files with 2 additions and 2 deletions

View File

@ -7,7 +7,7 @@ from news.models import News
from sorl.thumbnail import get_thumbnail
class Command(BaseCommand):
SORL_THUMBNAIL_ALIASES = 'news_image'
SORL_THUMBNAIL_ALIASES = 'news_description'
def add_arguments(self, parser):
parser.add_argument(

View File

@ -173,5 +173,4 @@ def section_name_into_index_name(section_name: str):
def get_url_images_in_text(text):
"""Find images urls in text"""
import re
return re.findall(r'(?:http:|https:)?//.*\.(?:png|jpg|svg)', text)

View File

@ -385,6 +385,7 @@ THUMBNAIL_QUALITY = 85
THUMBNAIL_DEBUG = False
SORL_THUMBNAIL_ALIASES = {
'news_preview': {'geometry_string': '300x260', 'crop': 'center'},
'news_description': {'geometry_string': '100x100', 'quality': 50},
'news_promo_horizontal_web': {'geometry_string': '1900x600', 'crop': 'center'},
'news_promo_horizontal_mobile': {'geometry_string': '375x260', 'crop': 'center'},
'news_tile_horizontal_web': {'geometry_string': '300x275', 'crop': 'center'},