def slugify(value): """ unicodedata (lib Django's slugify is using) does not recognize đ and Đ, and therefore omits them. We manually replace them with d and D. """ return _slugify(value.replace(u'đ', u'd').replace(u'Đ', u'D'))
def slugify(model, text): """ Make a unique slug for an object of the given model with the given text. Assumes the slug field is called 'slug'. """ slug = _slugify(text) same_slug_count = model.objects.filter(slug__iregex=slug + '(-\d+)?').count() if same_slug_count: slug = "%s-%d" % (slug, same_slug_count) return slug
def slugify(value, length=MAX_SLUG_LENGTH): """runs the given value through django's slugify filter and slices it to a given length :param value: the value you want turned into a slug :type value: str :param length: the maximum length of the slug :type length: int :return: the slugified version of the input value sliced to the length value :rtype: str """ slug = _slugify(value)[:length] while slug.endswith("-"): slug = slug[:-1] return slug
def slugify(text): return _slugify(text).replace('-','_')
def produto_pre_save(signal, instance, sender, **kwargs): instance.slug = _slugify(instance.nome)
def slugify(string): return _slugify(string).replace('-', '')
def _sql_paths(*args): args = [str(arg) for arg in args] args.append(_slugify(_get_branch_name(False))) return _slugify('-'.join(args)) + '.sql.gz'
def slugify(value): return _slugify(unidecode(str(value)))
def slugify(value): value = value.replace(u'æ', 'ae').replace(u'ø', 'o').replace(u'å', 'aa') value = value.replace(u'ö', 'o').replace(u'ä', 'aa') return _slugify(value)
def slugify(s): from django.template.defaultfilters import slugify as _slugify from unidecode import unidecode s = unidecode(s) return _slugify(s)