X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/fd1a9915dd65789cccf27041a1f01cd4077273fc..165161a173154072eb7b999386a13562e110bd0a:/src/chunks/models.py 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]])