X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/4fa05f4b9dc3567ab66a7a3a4827ea64b582a4ee..b93544446c1afb2324e12cef0e670705893797cd:/apps/picture/models.py diff --git a/apps/picture/models.py b/apps/picture/models.py index 8aa6f975c..0217d8bad 100644 --- a/apps/picture/models.py +++ b/apps/picture/models.py @@ -9,7 +9,6 @@ from django.template.loader import render_to_string from django.core.cache import cache from catalogue.utils import split_tags from django.utils.safestring import mark_safe -from librarian import dcparser from slughifi import slughifi from django.utils.translation import ugettext_lazy as _ @@ -45,9 +44,6 @@ class Picture(models.Model): verbose_name = _('picture') verbose_name_plural = _('pictures') - URLID_RE = r'[a-z0-9-]+' - FILEID_RE = r'[a-z0-9-]+' - def save(self, force_insert=False, force_update=False, reset_short_html=True, **kwargs): from sortify import sortify @@ -65,10 +61,7 @@ class Picture(models.Model): @permalink def get_absolute_url(self): - return ('picture.views.picture_detail', [self.urlid()]) - - def urlid(self): - return self.slug + return ('picture.views.picture_detail', [self.slug]) @classmethod def from_xml_file(cls, xml_file, image_file=None, overwrite=False): @@ -168,6 +161,8 @@ class Picture(models.Model): @property def info(self): if not hasattr(self, '_info'): + from librarian import dcparser + from librarian import picture info = dcparser.parse(self.xml_file.path, picture.PictureInfo) self._info = info return self._info