Set license constants.
authorRadek Czajka <rczajka@rczajka.pl>
Thu, 21 May 2020 12:28:41 +0000 (14:28 +0200)
committerRadek Czajka <rczajka@rczajka.pl>
Thu, 21 May 2020 12:28:41 +0000 (14:28 +0200)
src/archive/settings.py
src/youtube/models.py

index 5c8e5f1..3e6f96f 100644 (file)
@@ -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
index 576bf49..1a3fd01 100644 (file)
@@ -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))