X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/f3e8dfa015744bd72796fdd8eff0d81f863cdc46..bad8c938b9e545cd4360204e6fd0459b83718c13:/src/chunks/models.py?ds=sidebyside diff --git a/src/chunks/models.py b/src/chunks/models.py index 56166a33e..f5fdbbf77 100644 --- a/src/chunks/models.py +++ b/src/chunks/models.py @@ -4,6 +4,7 @@ from django.conf import settings from django.core.cache import cache from django.db import models +from django.urls import reverse from django.utils.translation import ugettext_lazy as _ @@ -42,3 +43,6 @@ class Attachment(models.Model): def __str__(self): return self.key + + def get_absolute_url(self): + return reverse('chunks_attachment', args=[self.key, self.attachment.name.rsplit('.', 1)[-1]])