X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/23f0993732ac597e0a4ab1330b62b970c09d476c..67f5a03a4014feed95edf75d165f3cd669041426:/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