from django.db.models.fields.files import FieldFile
from catalogue import app_settings
from catalogue.constants import LANGUAGES_3TO2, EBOOK_FORMATS_WITH_CHILDREN, EBOOK_FORMATS_WITHOUT_CHILDREN
-from catalogue.utils import remove_zip, truncate_html_words, gallery_path, gallery_url
+from catalogue.utils import absolute_url, remove_zip, truncate_html_words, gallery_path, gallery_url
from celery.task import Task, task
from celery.utils.log import get_task_logger
from waiter.utils import clear_cache
def transform(wldoc, fieldfile):
return wldoc.as_pdf(
morefloats=settings.LIBRARIAN_PDF_MOREFLOATS, cover=True,
- base_url=gallery_url(wldoc.book_info.url.slug), customizations=['notoc'])
+ base_url=absolute_url(gallery_url(wldoc.book_info.url.slug)), customizations=['notoc'])
def build(self, fieldfile):
BuildEbook.build(self, fieldfile)
class BuildEpub(BuildEbook):
@staticmethod
def transform(wldoc, fieldfile):
- return wldoc.as_epub(cover=True, base_url=gallery_url(wldoc.book_info.url.slug))
+ return wldoc.as_epub(cover=True, base_url=absolute_url(gallery_url(wldoc.book_info.url.slug)))
@BuildEbook.register('mobi')
class BuildMobi(BuildEbook):
@staticmethod
def transform(wldoc, fieldfile):
- return wldoc.as_mobi(cover=True, base_url=gallery_url(wldoc.book_info.url.slug))
+ return wldoc.as_mobi(cover=True, base_url=absolute_url(gallery_url(wldoc.book_info.url.slug)))
@BuildEbook.register('html')
slug = url_elem.text.rstrip('/').rsplit('/', 1)[1]
gal_url = gallery_url(slug=slug)
gal_path = gallery_path(slug=slug)
- return wldoc.as_html(gallery_path=gal_path, gallery_url=gal_url, base_url=gal_url)
+ return wldoc.as_html(gallery_path=gal_path, gallery_url=gal_url, base_url=absolute_url(gal_url))
class BuildCover(BuildEbook):
msgid "parent number"
msgstr "Elternnummer"
-#: catalogue/models/book.py:69 catalogue/models/bookmedia.py:41
+#: catalogue/models/book.py:69 catalogue/models/bookmedia.py:43
msgid "extra information"
msgstr "zusätzliche Informationen"
msgid "file"
msgstr "XML-Datei"
-#: catalogue/models/bookmedia.py:50 catalogue/models/bookmedia.py:51
+#: catalogue/models/bookmedia.py:52 catalogue/models/bookmedia.py:53
msgid "book media"
msgstr "book media"
msgid "Read online"
msgstr "Online lesen"
-#: catalogue/templates/catalogue/book_short.html:123
+#: catalogue/templates/catalogue/book_short.html:115
msgid ""
"Cena książki w druku cyfrowym jest zależna od liczby stron.<br>Przed zakupem "
"upewnij się, że cena druku na żądanie jest dla Ciebie odpowiednia."
"bezpłatnie."
msgstr ""
-#: catalogue/templates/catalogue/book_short.html:123
+#: catalogue/templates/catalogue/book_short.html:115
msgid "Print on demand –"
msgstr ""
-#: catalogue/templates/catalogue/book_short.html:128
+#: catalogue/templates/catalogue/book_short.html:120
#: catalogue/templates/catalogue/custom_pdf_form.html:18 catalogue/views.py:404
msgid "Download"
msgstr "Herunterladen"
-#: catalogue/templates/catalogue/book_short.html:142
+#: catalogue/templates/catalogue/book_short.html:134
msgid "more"
msgstr ""
-#: catalogue/templates/catalogue/book_short.html:153
+#: catalogue/templates/catalogue/book_short.html:145
msgid "less"
msgstr ""
-#: catalogue/templates/catalogue/book_short.html:161
+#: catalogue/templates/catalogue/book_short.html:153
msgid "For now this work is only available for our subscribers."
msgstr ""
msgid "director:"
msgstr "Regisseur"
-#: catalogue/templates/catalogue/snippets/jplayer.html:61
+#: catalogue/templates/catalogue/snippets/jplayer.html:64
msgid "previous"
msgstr ""
-#: catalogue/templates/catalogue/snippets/jplayer.html:62
+#: catalogue/templates/catalogue/snippets/jplayer.html:65
msgid "Part"
msgstr ""
-#: catalogue/templates/catalogue/snippets/jplayer.html:63
+#: catalogue/templates/catalogue/snippets/jplayer.html:66
msgid "next"
msgstr ""
msgid "parent number"
msgstr "Parent number"
-#: catalogue/models/book.py:69 catalogue/models/bookmedia.py:41
+#: catalogue/models/book.py:69 catalogue/models/bookmedia.py:43
msgid "extra information"
msgstr "Additional information"
msgid "file"
msgstr "XML file"
-#: catalogue/models/bookmedia.py:50 catalogue/models/bookmedia.py:51
+#: catalogue/models/bookmedia.py:52 catalogue/models/bookmedia.py:53
msgid "book media"
msgstr "book media"
msgid "Read online"
msgstr "Read online"
-#: catalogue/templates/catalogue/book_short.html:123
+#: catalogue/templates/catalogue/book_short.html:115
msgid ""
"Cena książki w druku cyfrowym jest zależna od liczby stron.<br>Przed zakupem "
"upewnij się, że cena druku na żądanie jest dla Ciebie odpowiednia."
"bezpłatnie."
msgstr ""
-#: catalogue/templates/catalogue/book_short.html:123
+#: catalogue/templates/catalogue/book_short.html:115
msgid "Print on demand –"
msgstr ""
-#: catalogue/templates/catalogue/book_short.html:128
+#: catalogue/templates/catalogue/book_short.html:120
#: catalogue/templates/catalogue/custom_pdf_form.html:18 catalogue/views.py:404
msgid "Download"
msgstr "Download"
-#: catalogue/templates/catalogue/book_short.html:142
+#: catalogue/templates/catalogue/book_short.html:134
msgid "more"
msgstr ""
-#: catalogue/templates/catalogue/book_short.html:153
+#: catalogue/templates/catalogue/book_short.html:145
msgid "less"
msgstr ""
-#: catalogue/templates/catalogue/book_short.html:161
+#: catalogue/templates/catalogue/book_short.html:153
msgid "For now this work is only available for our subscribers."
msgstr ""
msgid "director:"
msgstr "Director"
-#: catalogue/templates/catalogue/snippets/jplayer.html:61
+#: catalogue/templates/catalogue/snippets/jplayer.html:64
msgid "previous"
msgstr ""
-#: catalogue/templates/catalogue/snippets/jplayer.html:62
+#: catalogue/templates/catalogue/snippets/jplayer.html:65
msgid "Part"
msgstr ""
-#: catalogue/templates/catalogue/snippets/jplayer.html:63
+#: catalogue/templates/catalogue/snippets/jplayer.html:66
msgid "next"
msgstr ""
msgid "parent number"
msgstr "cifra matriz"
-#: catalogue/models/book.py:69 catalogue/models/bookmedia.py:41
+#: catalogue/models/book.py:69 catalogue/models/bookmedia.py:43
msgid "extra information"
msgstr "información adicional"
msgid "file"
msgstr "archivo"
-#: catalogue/models/bookmedia.py:50 catalogue/models/bookmedia.py:51
+#: catalogue/models/bookmedia.py:52 catalogue/models/bookmedia.py:53
msgid "book media"
msgstr "los medios de el libro"
msgid "Read online"
msgstr "Leer en línea"
-#: catalogue/templates/catalogue/book_short.html:123
+#: catalogue/templates/catalogue/book_short.html:115
msgid ""
"Cena książki w druku cyfrowym jest zależna od liczby stron.<br>Przed zakupem "
"upewnij się, że cena druku na żądanie jest dla Ciebie odpowiednia."
"bezpłatnie."
msgstr ""
-#: catalogue/templates/catalogue/book_short.html:123
+#: catalogue/templates/catalogue/book_short.html:115
msgid "Print on demand –"
msgstr ""
-#: catalogue/templates/catalogue/book_short.html:128
+#: catalogue/templates/catalogue/book_short.html:120
#: catalogue/templates/catalogue/custom_pdf_form.html:18 catalogue/views.py:404
msgid "Download"
msgstr "Descargar"
-#: catalogue/templates/catalogue/book_short.html:142
+#: catalogue/templates/catalogue/book_short.html:134
msgid "more"
msgstr ""
-#: catalogue/templates/catalogue/book_short.html:153
+#: catalogue/templates/catalogue/book_short.html:145
msgid "less"
msgstr ""
-#: catalogue/templates/catalogue/book_short.html:161
+#: catalogue/templates/catalogue/book_short.html:153
msgid "For now this work is only available for our subscribers."
msgstr ""
msgid "director:"
msgstr "Director"
-#: catalogue/templates/catalogue/snippets/jplayer.html:61
+#: catalogue/templates/catalogue/snippets/jplayer.html:64
msgid "previous"
msgstr ""
-#: catalogue/templates/catalogue/snippets/jplayer.html:62
+#: catalogue/templates/catalogue/snippets/jplayer.html:65
msgid "Part"
msgstr ""
-#: catalogue/templates/catalogue/snippets/jplayer.html:63
+#: catalogue/templates/catalogue/snippets/jplayer.html:66
msgid "next"
msgstr ""
msgid "parent number"
msgstr "nombre de parent"
-#: catalogue/models/book.py:69 catalogue/models/bookmedia.py:41
+#: catalogue/models/book.py:69 catalogue/models/bookmedia.py:43
msgid "extra information"
msgstr "information supplémentaire"
msgid "file"
msgstr "fichier"
-#: catalogue/models/bookmedia.py:50 catalogue/models/bookmedia.py:51
+#: catalogue/models/bookmedia.py:52 catalogue/models/bookmedia.py:53
msgid "book media"
msgstr "book media"
msgid "Read online"
msgstr "Lire en ligne"
-#: catalogue/templates/catalogue/book_short.html:123
+#: catalogue/templates/catalogue/book_short.html:115
msgid ""
"Cena książki w druku cyfrowym jest zależna od liczby stron.<br>Przed zakupem "
"upewnij się, że cena druku na żądanie jest dla Ciebie odpowiednia."
"bezpłatnie."
msgstr ""
-#: catalogue/templates/catalogue/book_short.html:123
+#: catalogue/templates/catalogue/book_short.html:115
msgid "Print on demand –"
msgstr ""
-#: catalogue/templates/catalogue/book_short.html:128
+#: catalogue/templates/catalogue/book_short.html:120
#: catalogue/templates/catalogue/custom_pdf_form.html:18 catalogue/views.py:404
msgid "Download"
msgstr "Téléchargez"
-#: catalogue/templates/catalogue/book_short.html:142
+#: catalogue/templates/catalogue/book_short.html:134
msgid "more"
msgstr ""
-#: catalogue/templates/catalogue/book_short.html:153
+#: catalogue/templates/catalogue/book_short.html:145
msgid "less"
msgstr ""
-#: catalogue/templates/catalogue/book_short.html:161
+#: catalogue/templates/catalogue/book_short.html:153
msgid "For now this work is only available for our subscribers."
msgstr ""
msgid "director:"
msgstr "Metteur en scène"
-#: catalogue/templates/catalogue/snippets/jplayer.html:61
+#: catalogue/templates/catalogue/snippets/jplayer.html:64
msgid "previous"
msgstr ""
-#: catalogue/templates/catalogue/snippets/jplayer.html:62
+#: catalogue/templates/catalogue/snippets/jplayer.html:65
msgid "Part"
msgstr ""
-#: catalogue/templates/catalogue/snippets/jplayer.html:63
+#: catalogue/templates/catalogue/snippets/jplayer.html:66
msgid "next"
msgstr ""
msgid "parent number"
msgstr "numero del genitore"
-#: catalogue/models/book.py:69 catalogue/models/bookmedia.py:41
+#: catalogue/models/book.py:69 catalogue/models/bookmedia.py:43
msgid "extra information"
msgstr " ulteriori informazioni"
msgid "file"
msgstr "file"
-#: catalogue/models/bookmedia.py:50 catalogue/models/bookmedia.py:51
+#: catalogue/models/bookmedia.py:52 catalogue/models/bookmedia.py:53
msgid "book media"
msgstr "book media"
msgid "Read online"
msgstr "Leggi online"
-#: catalogue/templates/catalogue/book_short.html:123
+#: catalogue/templates/catalogue/book_short.html:115
msgid ""
"Cena książki w druku cyfrowym jest zależna od liczby stron.<br>Przed zakupem "
"upewnij się, że cena druku na żądanie jest dla Ciebie odpowiednia."
"bezpłatnie."
msgstr ""
-#: catalogue/templates/catalogue/book_short.html:123
+#: catalogue/templates/catalogue/book_short.html:115
msgid "Print on demand –"
msgstr ""
-#: catalogue/templates/catalogue/book_short.html:128
+#: catalogue/templates/catalogue/book_short.html:120
#: catalogue/templates/catalogue/custom_pdf_form.html:18 catalogue/views.py:404
msgid "Download"
msgstr "Scarica"
-#: catalogue/templates/catalogue/book_short.html:142
+#: catalogue/templates/catalogue/book_short.html:134
msgid "more"
msgstr ""
-#: catalogue/templates/catalogue/book_short.html:153
+#: catalogue/templates/catalogue/book_short.html:145
msgid "less"
msgstr ""
-#: catalogue/templates/catalogue/book_short.html:161
+#: catalogue/templates/catalogue/book_short.html:153
msgid "For now this work is only available for our subscribers."
msgstr ""
msgid "director:"
msgstr "Direttore"
-#: catalogue/templates/catalogue/snippets/jplayer.html:61
+#: catalogue/templates/catalogue/snippets/jplayer.html:64
msgid "previous"
msgstr ""
-#: catalogue/templates/catalogue/snippets/jplayer.html:62
+#: catalogue/templates/catalogue/snippets/jplayer.html:65
msgid "Part"
msgstr ""
-#: catalogue/templates/catalogue/snippets/jplayer.html:63
+#: catalogue/templates/catalogue/snippets/jplayer.html:66
msgid "next"
msgstr ""
msgid "parent number"
msgstr "pirminis numeris"
-#: catalogue/models/book.py:69 catalogue/models/bookmedia.py:41
+#: catalogue/models/book.py:69 catalogue/models/bookmedia.py:43
msgid "extra information"
msgstr "papildomos informacijos"
msgid "file"
msgstr "failas "
-#: catalogue/models/bookmedia.py:50 catalogue/models/bookmedia.py:51
+#: catalogue/models/bookmedia.py:52 catalogue/models/bookmedia.py:53
msgid "book media"
msgstr "book media"
msgid "Read online"
msgstr "Skaityti online"
-#: catalogue/templates/catalogue/book_short.html:123
+#: catalogue/templates/catalogue/book_short.html:115
msgid ""
"Cena książki w druku cyfrowym jest zależna od liczby stron.<br>Przed zakupem "
"upewnij się, że cena druku na żądanie jest dla Ciebie odpowiednia."
"bezpłatnie."
msgstr ""
-#: catalogue/templates/catalogue/book_short.html:123
+#: catalogue/templates/catalogue/book_short.html:115
msgid "Print on demand –"
msgstr ""
-#: catalogue/templates/catalogue/book_short.html:128
+#: catalogue/templates/catalogue/book_short.html:120
#: catalogue/templates/catalogue/custom_pdf_form.html:18 catalogue/views.py:404
msgid "Download"
msgstr "Atsisiųsti"
-#: catalogue/templates/catalogue/book_short.html:142
+#: catalogue/templates/catalogue/book_short.html:134
msgid "more"
msgstr ""
-#: catalogue/templates/catalogue/book_short.html:153
+#: catalogue/templates/catalogue/book_short.html:145
msgid "less"
msgstr ""
-#: catalogue/templates/catalogue/book_short.html:161
+#: catalogue/templates/catalogue/book_short.html:153
msgid "For now this work is only available for our subscribers."
msgstr ""
msgid "director:"
msgstr "Režisierus"
-#: catalogue/templates/catalogue/snippets/jplayer.html:61
+#: catalogue/templates/catalogue/snippets/jplayer.html:64
msgid "previous"
msgstr ""
-#: catalogue/templates/catalogue/snippets/jplayer.html:62
+#: catalogue/templates/catalogue/snippets/jplayer.html:65
msgid "Part"
msgstr ""
-#: catalogue/templates/catalogue/snippets/jplayer.html:63
+#: catalogue/templates/catalogue/snippets/jplayer.html:66
msgid "next"
msgstr ""
msgid "parent number"
msgstr "numer rodzica"
-#: catalogue/models/book.py:69 catalogue/models/bookmedia.py:41
+#: catalogue/models/book.py:69 catalogue/models/bookmedia.py:43
msgid "extra information"
msgstr "dodatkowe informacje"
msgid "file"
msgstr "plik"
-#: catalogue/models/bookmedia.py:50 catalogue/models/bookmedia.py:51
+#: catalogue/models/bookmedia.py:52 catalogue/models/bookmedia.py:53
msgid "book media"
msgstr "media książki"
msgid "Read online"
msgstr "Czytaj online"
-#: catalogue/templates/catalogue/book_short.html:123
+#: catalogue/templates/catalogue/book_short.html:115
msgid ""
"Cena książki w druku cyfrowym jest zależna od liczby stron.<br>Przed zakupem "
"upewnij się, że cena druku na żądanie jest dla Ciebie odpowiednia."
"bezpłatnie."
msgstr ""
-#: catalogue/templates/catalogue/book_short.html:123
+#: catalogue/templates/catalogue/book_short.html:115
msgid "Print on demand –"
msgstr "Druk na żądanie z"
-#: catalogue/templates/catalogue/book_short.html:128
+#: catalogue/templates/catalogue/book_short.html:120
#: catalogue/templates/catalogue/custom_pdf_form.html:18 catalogue/views.py:404
msgid "Download"
msgstr "Pobierz"
-#: catalogue/templates/catalogue/book_short.html:142
+#: catalogue/templates/catalogue/book_short.html:134
msgid "more"
msgstr "więcej"
-#: catalogue/templates/catalogue/book_short.html:153
+#: catalogue/templates/catalogue/book_short.html:145
msgid "less"
msgstr "mniej"
-#: catalogue/templates/catalogue/book_short.html:161
+#: catalogue/templates/catalogue/book_short.html:153
msgid "For now this work is only available for our subscribers."
msgstr "Jak na razie ten utwór jest dostępny wyłącznie dla naszych Przyjaciół."
msgid "director:"
msgstr "reż."
-#: catalogue/templates/catalogue/snippets/jplayer.html:61
+#: catalogue/templates/catalogue/snippets/jplayer.html:64
msgid "previous"
msgstr "poprzednia"
-#: catalogue/templates/catalogue/snippets/jplayer.html:62
+#: catalogue/templates/catalogue/snippets/jplayer.html:65
msgid "Part"
msgstr "Część"
-#: catalogue/templates/catalogue/snippets/jplayer.html:63
+#: catalogue/templates/catalogue/snippets/jplayer.html:66
msgid "next"
msgstr "następna"
msgid "parent number"
msgstr "номер родителя"
-#: catalogue/models/book.py:69 catalogue/models/bookmedia.py:41
+#: catalogue/models/book.py:69 catalogue/models/bookmedia.py:43
msgid "extra information"
msgstr "дополнительная информация"
msgid "file"
msgstr "XML файл"
-#: catalogue/models/bookmedia.py:50 catalogue/models/bookmedia.py:51
+#: catalogue/models/bookmedia.py:52 catalogue/models/bookmedia.py:53
msgid "book media"
msgstr "аудиокнига"
msgid "Read online"
msgstr "Читать онлайн"
-#: catalogue/templates/catalogue/book_short.html:123
+#: catalogue/templates/catalogue/book_short.html:115
msgid ""
"Cena książki w druku cyfrowym jest zależna od liczby stron.<br>Przed zakupem "
"upewnij się, że cena druku na żądanie jest dla Ciebie odpowiednia."
"bezpłatnie."
msgstr ""
-#: catalogue/templates/catalogue/book_short.html:123
+#: catalogue/templates/catalogue/book_short.html:115
msgid "Print on demand –"
msgstr ""
-#: catalogue/templates/catalogue/book_short.html:128
+#: catalogue/templates/catalogue/book_short.html:120
#: catalogue/templates/catalogue/custom_pdf_form.html:18 catalogue/views.py:404
msgid "Download"
msgstr "Загрузить"
-#: catalogue/templates/catalogue/book_short.html:142
+#: catalogue/templates/catalogue/book_short.html:134
msgid "more"
msgstr ""
-#: catalogue/templates/catalogue/book_short.html:153
+#: catalogue/templates/catalogue/book_short.html:145
msgid "less"
msgstr ""
-#: catalogue/templates/catalogue/book_short.html:161
+#: catalogue/templates/catalogue/book_short.html:153
msgid "For now this work is only available for our subscribers."
msgstr ""
msgid "director:"
msgstr "режиссер"
-#: catalogue/templates/catalogue/snippets/jplayer.html:61
+#: catalogue/templates/catalogue/snippets/jplayer.html:64
msgid "previous"
msgstr ""
-#: catalogue/templates/catalogue/snippets/jplayer.html:62
+#: catalogue/templates/catalogue/snippets/jplayer.html:65
msgid "Part"
msgstr ""
-#: catalogue/templates/catalogue/snippets/jplayer.html:63
+#: catalogue/templates/catalogue/snippets/jplayer.html:66
msgid "next"
msgstr ""
msgid "parent number"
msgstr "номер батька"
-#: catalogue/models/book.py:69 catalogue/models/bookmedia.py:41
+#: catalogue/models/book.py:69 catalogue/models/bookmedia.py:43
msgid "extra information"
msgstr "додаткова інформація"
msgid "file"
msgstr "файл"
-#: catalogue/models/bookmedia.py:50 catalogue/models/bookmedia.py:51
+#: catalogue/models/bookmedia.py:52 catalogue/models/bookmedia.py:53
msgid "book media"
msgstr "book media"
msgid "Read online"
msgstr "Читати онлайн"
-#: catalogue/templates/catalogue/book_short.html:123
+#: catalogue/templates/catalogue/book_short.html:115
msgid ""
"Cena książki w druku cyfrowym jest zależna od liczby stron.<br>Przed zakupem "
"upewnij się, że cena druku na żądanie jest dla Ciebie odpowiednia."
"bezpłatnie."
msgstr ""
-#: catalogue/templates/catalogue/book_short.html:123
+#: catalogue/templates/catalogue/book_short.html:115
msgid "Print on demand –"
msgstr ""
-#: catalogue/templates/catalogue/book_short.html:128
+#: catalogue/templates/catalogue/book_short.html:120
#: catalogue/templates/catalogue/custom_pdf_form.html:18 catalogue/views.py:404
msgid "Download"
msgstr "Завантажити"
-#: catalogue/templates/catalogue/book_short.html:142
+#: catalogue/templates/catalogue/book_short.html:134
msgid "more"
msgstr ""
-#: catalogue/templates/catalogue/book_short.html:153
+#: catalogue/templates/catalogue/book_short.html:145
msgid "less"
msgstr ""
-#: catalogue/templates/catalogue/book_short.html:161
+#: catalogue/templates/catalogue/book_short.html:153
msgid "For now this work is only available for our subscribers."
msgstr ""
msgid "director:"
msgstr "Режисер"
-#: catalogue/templates/catalogue/snippets/jplayer.html:61
+#: catalogue/templates/catalogue/snippets/jplayer.html:64
msgid "previous"
msgstr ""
-#: catalogue/templates/catalogue/snippets/jplayer.html:62
+#: catalogue/templates/catalogue/snippets/jplayer.html:65
msgid "Part"
msgstr ""
-#: catalogue/templates/catalogue/snippets/jplayer.html:63
+#: catalogue/templates/catalogue/snippets/jplayer.html:66
msgid "next"
msgstr ""
from django.conf import settings
from django.utils import timezone
-from catalogue.utils import gallery_url
+from catalogue.utils import absolute_url, gallery_url
from waiter.models import WaitedFile
task_logger = get_task_logger(__name__)
pdf = wldoc.as_pdf(
customizations=customizations,
morefloats=settings.LIBRARIAN_PDF_MOREFLOATS,
- base_url=gallery_url(wldoc.book_info.url.slug),
+ base_url=absolute_url(gallery_url(wldoc.book_info.url.slug)),
**kwargs)
DefaultStorage().save(file_name, File(open(pdf.get_filename(), 'rb')))
finally:
from errno import EEXIST, ENOENT
from fcntl import flock, LOCK_EX
from os import mkdir, path, unlink
+from urllib.parse import urljoin
from zipfile import ZipFile
+from django.apps import apps
from django.conf import settings
from django.core.files.storage import DefaultStorage
from django.core.files.uploadedfile import UploadedFile
return '%s%s%s/' % (settings.MEDIA_URL, settings.IMAGE_DIR, slug)
+def absolute_url(url):
+ Site = apps.get_model('sites', 'Site')
+ site = Site.objects.get_current()
+ base_url = '%s://%s' % (
+ 'https' if settings.SESSION_COOKIE_SECURE else 'http',
+ site.domain
+ )
+ return urljoin(base_url, url)
+
+
def get_mp3_length(path):
from mutagen.mp3 import MP3
return int(MP3(path).info.length)