diff --git a/CHANGES b/CHANGES index b9f7cec..e5e3180 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +0.3.9 2018-09-20 +- Slugify style slug in StyleMixin + 0.3.8 2018-09-14 - SectionBase: use downgrading slug field diff --git a/content_plugins/plugins/mixins.py b/content_plugins/plugins/mixins.py index 6253a43..29dc639 100644 --- a/content_plugins/plugins/mixins.py +++ b/content_plugins/plugins/mixins.py @@ -3,6 +3,8 @@ import os from django.db import models from django.utils.translation import ugettext_lazy as _ +from shared.utils.text import slugify + class StyleField(models.CharField): """ @@ -23,7 +25,8 @@ class StyleMixin(models.Model): abstract = True def get_style_slug(self): - return getattr(self, 'style', None) or 'default' + style = getattr(self, 'style', None) or 'default' + return slugify(style).replace("_", "-") # # Compatibiliy with super classes not having a prefixed_path method # def prefixed_path(self, path):