X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/23f0993732ac597e0a4ab1330b62b970c09d476c..9e8facc1106d26c39a023f5beb3d01777d7cdad4:/apps/libraries/models.py diff --git a/apps/libraries/models.py b/apps/libraries/models.py index c6db612b9..5f92421fc 100644 --- a/apps/libraries/models.py +++ b/apps/libraries/models.py @@ -24,6 +24,7 @@ class Library(models.Model): """Represent a single library in the libraries dictionary""" name = models.CharField(_('name'), max_length = 120, blank = True) + slug = models.SlugField(_('slug'), max_length = 120, unique = True, db_index = True, null = True) catalog = models.ForeignKey(Catalog, null = False, related_name = 'libraries', on_delete = models.PROTECT) url = models.CharField(_('url'), max_length = 120, blank = True) description = models.TextField(_('description'), blank = True) @@ -35,3 +36,6 @@ class Library(models.Model): def __unicode__(self): return self.name + @models.permalink + def get_absolute_url(self): + return ('libraries_library_view', [self.catalog.slug, self.slug]) \ No newline at end of file