From: Radek Czajka Date: Thu, 21 May 2020 12:28:41 +0000 (+0200) Subject: Set license constants. X-Git-Url: https://git.mdrn.pl/audio.git/commitdiff_plain/e1b56c9335e1b315fcce885d95a9d9d7a86fe566?ds=inline Set license constants. --- diff --git a/src/archive/settings.py b/src/archive/settings.py index 5c8e5f1..3e6f96f 100644 --- a/src/archive/settings.py +++ b/src/archive/settings.py @@ -55,10 +55,18 @@ try: except AttributeError: PROJECT = 'Wolne Lektury' -try: - LICENSE = settings.ARCHIVE_LICENSE -except AttributeError: - LICENSE = 'http://creativecommons.org/licenses/by-sa/3.0/deed.pl' + +LICENSE = getattr( + settings, + 'ARCHIVE_LICENSE', + 'http://artlibre.org/licence/lal/pl/' +) + +LICENSE_NAME = getattr( + settings, 'ARCHIVE_LICENSE_NAME', + 'Licencja Wolnej Sztuki 1.3' +) + try: ORGANIZATION = settings.ARCHIVE_ORGANIZATION diff --git a/src/youtube/models.py b/src/youtube/models.py index 576bf49..1a3fd01 100644 --- a/src/youtube/models.py +++ b/src/youtube/models.py @@ -1,6 +1,7 @@ import io from os import unlink from tempfile import NamedTemporaryFile +from django.conf import settings from django.db import models from django.utils.translation import gettext_lazy as _ from django.template import Template, Context @@ -42,7 +43,11 @@ class YouTube(models.Model): verbose_name_plural = _("YouTube configurations") def get_context(self, audiobook): - return Context(dict(audiobook=audiobook)) + return Context(dict( + audiobook=audiobook, + LICENSE=settings.LICENSE, + LICENSE_NAME=settings.LICENSE_NAME, + )) def get_description(self, audiobook): return Template(self.description_template).render(self.get_context(audiobook))