Browse Source

SlugField: Leave empty slug if blank=True.

master 0.2.24
Erik Stein 6 years ago
parent
commit
739a306cac
  1. 4
      CHANGES
  2. 2
      shared/utils/models/slugs.py

4
CHANGES

@ -1,3 +1,7 @@
0.2.24 2019-03-18
- SlugField: Leave empty slug if blank=True.
- SlugField: Don't force None to "none" string.
0.2.23 2019-03-18
- lang_suffix: 'field_name' paramter instead of 'fieldname'.

2
shared/utils/models/slugs.py

@ -66,7 +66,7 @@ class AutoSlugField(django_fields.SlugField):
if callable(value):
value = value()
value = self.slugify(value)
if not value:
if not value and not self.blank:
value = model_instance._meta.model_name
if self.unique_slug:
# TODO Move import to top of file once AutoSlugField is removed from shared.utils.fields and we no longer have a circular import

Loading…
Cancel
Save