コード例 #1
0
ファイル: string_operations.py プロジェクト: ikicic/skoljka
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'))
コード例 #2
0
ファイル: utils.py プロジェクト: ebrelsford/cas_food
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
コード例 #3
0
ファイル: slugs.py プロジェクト: vforgione/bulbs2
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
コード例 #4
0
ファイル: dblp_spider.py プロジェクト: dlaz/robotlab-site
def slugify(text):
	return _slugify(text).replace('-','_')
コード例 #5
0
def produto_pre_save(signal, instance, sender, **kwargs):
    instance.slug = _slugify(instance.nome)
コード例 #6
0
ファイル: import_locations.py プロジェクト: malthe/cvs
def slugify(string):
    return _slugify(string).replace('-', '')
コード例 #7
0
ファイル: fab.py プロジェクト: ArabellaTech/ydcommon
def _sql_paths(*args):
    args = [str(arg) for arg in args]
    args.append(_slugify(_get_branch_name(False)))
    return _slugify('-'.join(args)) + '.sql.gz'
コード例 #8
0
def slugify(value):
    return _slugify(unidecode(str(value)))
コード例 #9
0
ファイル: util.py プロジェクト: relekang/fs-reference
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)
コード例 #10
0
ファイル: __init__.py プロジェクト: ichem/django-seuranta
def slugify(s):
    from django.template.defaultfilters import slugify as _slugify
    from unidecode import unidecode
    s = unidecode(s)
    return _slugify(s)