X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/80b56e4c5f668a8011bdf859504d45b7b7f6d914..a7a645daaf8e5e3da4542303bacd6b4d9bb14f2f:/apps/libraries/models.py diff --git a/apps/libraries/models.py b/apps/libraries/models.py index 1ed43ad77..5f92421fc 100644 --- a/apps/libraries/models.py +++ b/apps/libraries/models.py @@ -17,13 +17,14 @@ class Catalog(models.Model): @models.permalink def get_absolute_url(self): - return ('library_view', [self.slug]) + return ('libraries_catalog_view', [self.slug]) 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