Python django.conf.settings 模块,TIME_FORMAT 实例源码

我们从Python开源项目中,提取了以下7个代码示例,用于说明如何使用django.conf.settings.TIME_FORMAT

项目:CodingDojo    作者:ComputerSocietyUNB    | 项目源码 | 文件源码
def time(value, arg=None):
    """Formats a time according to the given format."""
    if value in (None, ''):
        return ''
    if arg is None:
        arg = settings.TIME_FORMAT
    try:
        return formats.time_format(value, arg)
    except AttributeError:
        try:
            return time_format(value, arg)
        except AttributeError:
            return ''
项目:DjangoBlog    作者:liangliangyy    | 项目源码 | 文件源码
def timeformat(data):
    try:
        return data.strftime(settings.TIME_FORMAT)
        # print(data.strftime(settings.TIME_FORMAT))
        # return "ddd"
    except:
        return ""
项目:extractfacts    作者:oneroyalace    | 项目源码 | 文件源码
def __init__(self, format=None, *args, **kwargs):
        if format is None:
            format = settings.TIME_FORMAT
        template = '{{ value|date:"%s"|default:default }}' % format
        super(TimeColumn, self).__init__(template_code=template, *args, **kwargs)
项目:extractfacts    作者:oneroyalace    | 项目源码 | 文件源码
def __init__(self, format=None, *args, **kwargs):
        if format is None:
            format = settings.TIME_FORMAT
        template = '{{ value|date:"%s"|default:default }}' % format
        super(TimeColumn, self).__init__(template_code=template, *args, **kwargs)
项目:djanoDoc    作者:JustinChavez    | 项目源码 | 文件源码
def time(value, arg=None):
    """Formats a time according to the given format."""
    if value in (None, ''):
        return ''
    if arg is None:
        arg = settings.TIME_FORMAT
    try:
        return formats.time_format(value, arg)
    except AttributeError:
        try:
            return time_format(value, arg)
        except AttributeError:
            return ''
项目:django-next-train    作者:bitpixdigital    | 项目源码 | 文件源码
def time(value, arg=None):
    """Formats a time according to the given format."""
    if value in (None, ''):
        return ''
    if arg is None:
        arg = settings.TIME_FORMAT
    try:
        return formats.time_format(value, arg)
    except AttributeError:
        try:
            return time_format(value, arg)
        except AttributeError:
            return ''
项目:django-wechat-api    作者:crazy-canux    | 项目源码 | 文件源码
def time(value, arg=None):
    """Formats a time according to the given format."""
    if value in (None, ''):
        return ''
    if arg is None:
        arg = settings.TIME_FORMAT
    try:
        return formats.time_format(value, arg)
    except AttributeError:
        try:
            return time_format(value, arg)
        except AttributeError:
            return ''