django_tables2.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:extractfacts 作者: oneroyalace 项目源码 文件源码
def title(value):
    '''
    A slightly better title template filter.

    Same as Django's builtin `~django.template.defaultfilters.title` filter,
    but operates on individual words and leaves words unchanged if they already
    have a capital letter.
    '''

    def title_word(w):
        return w if RE_UPPERCASE.search(w) else old_title(w)

    return re.sub('(\S+)', lambda m: title_word(m.group(0)), value)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号