X-Git-Url: https://git.mdrn.pl/audio.git/blobdiff_plain/0678dd50bd89ef1ad0f0d95c1e7907e31187a0d3..a07174f03214b000dcd01c31b6d397a85b15e82f:/src/archive/models.py diff --git a/src/archive/models.py b/src/archive/models.py index d8b85ad..a4420a9 100644 --- a/src/archive/models.py +++ b/src/archive/models.py @@ -16,6 +16,9 @@ class License(models.Model): uri = models.CharField(max_length=255, unique=True) name = models.CharField(max_length=255) + def __str__(self): + return self.name + class Project(models.Model): """ an audiobook project, needed for specyfing sponsors """ @@ -129,8 +132,11 @@ class Audiobook(models.Model): if self.translator: title += ' (tłum. %s)' % self.translator - copyright = "%s %s. Licensed to the public under %s verify at %s" % ( - self.date, ORGANIZATION, self.license.uri, self.url) + copyright = "%s %s." % ( + self.date, ORGANIZATION) + if self.license: + copyright += " Licensed to the public under %s verify at %s" % ( + self.license.uri, self.url) comment = "\n".join(( self.project.get_description(), @@ -148,11 +154,12 @@ class Audiobook(models.Model): 'date': self.date, 'genre': 'Speech', 'language': 'pol', - 'license': self.license.uri, 'organization': ORGANIZATION, 'title': title, 'project': self.project.name, } + if self.license: + tags['license'] = self.license.uri if self.project.sponsors: tags['funded_by'] = self.project.sponsors