X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/23f0993732ac597e0a4ab1330b62b970c09d476c..fd6cf046f53bdd89d6cf49cd4f7387c3e9ff86ad:/apps/libraries/models.py?ds=inline 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