lowercase shelf identifier

This commit is contained in:
Mouse Reeve 2020-11-10 14:56:53 -08:00
parent 408ca6609c
commit 0e13616e73

View File

@ -28,7 +28,7 @@ class Shelf(OrderedCollectionMixin, BookWyrmModel):
''' set the identifier ''' ''' set the identifier '''
saved = super().save(*args, **kwargs) saved = super().save(*args, **kwargs)
if not self.identifier: if not self.identifier:
slug = re.sub(r'[^\w]', '', self.name) slug = re.sub(r'[^\w]', '', self.name).lower()
self.identifier = '%s-%d' % (slug, self.id) self.identifier = '%s-%d' % (slug, self.id)
return super().save(*args, **kwargs) return super().save(*args, **kwargs)
return saved return saved