diff --git a/boards/models/attachment/domains.py b/boards/models/attachment/domains.py new file mode 100644 --- /dev/null +++ b/boards/models/attachment/domains.py @@ -0,0 +1,6 @@ +URL_DOMAINS = { + 'meduza.io': 'meduza', + 'youtube.com': 'youtube', + 'youtu.be': 'youtube', + 'wikipedia.org': 'wikipedia', +} diff --git a/boards/models/attachment/viewers.py b/boards/models/attachment/viewers.py --- a/boards/models/attachment/viewers.py +++ b/boards/models/attachment/viewers.py @@ -1,10 +1,11 @@ -import os import re +from django.contrib.staticfiles import finders +from django.contrib.staticfiles.templatetags.staticfiles import static from django.core.files.images import get_image_dimensions from django.template.defaultfilters import filesizeformat -from django.contrib.staticfiles.templatetags.staticfiles import static -from django.contrib.staticfiles import finders + +from boards.models.attachment.domains import URL_DOMAINS REGEX_DOMAIN = re.compile(r'(\w+\.)*(\w+\.\w+)') @@ -46,13 +47,6 @@ URL_PROTOCOLS = { 'magnet': 'magnet', } -URL_DOMAINS = { - 'meduza.io': 'meduza', - 'youtube.com': 'youtube', - 'youtu.be': 'youtube', - 'wikipedia.org': 'wikipedia', -} - CSS_CLASS_IMAGE = 'image' CSS_CLASS_THUMB = 'thumb'