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

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

项目:CodingDojo    作者:ComputerSocietyUNB    | 项目源码 | 文件源码
def date(value, arg=None):
    """Formats a date according to the given format."""
    if value in (None, ''):
        return ''
    if arg is None:
        arg = settings.DATE_FORMAT
    try:
        return formats.date_format(value, arg)
    except AttributeError:
        try:
            return format(value, arg)
        except AttributeError:
            return ''
项目:wagtail_room_booking    作者:Tamriel    | 项目源码 | 文件源码
def __str__(self):
        return ugettext('%(title)s: %(start)s - %(end)s') % {
            'title': self.title,
            'start': date(self.start, django_settings.DATE_FORMAT),
            'end': date(self.end, django_settings.DATE_FORMAT),
        }
项目:wagtail_room_booking    作者:Tamriel    | 项目源码 | 文件源码
def __str__(self):
        return ugettext("%(start)s to %(end)s") % {
            'start': date(self.start, django_settings.DATE_FORMAT),
            'end': date(self.end, django_settings.DATE_FORMAT)
        }
项目:wagtail_room_booking    作者:Tamriel    | 项目源码 | 文件源码
def prevnext(target, calendar, period, fmt=None):
    if fmt is None:
        fmt = settings.DATE_FORMAT
    context = {
        'calendar': calendar,
        'period': period,
        'period_name': format(period.start, fmt),
        'target': target,
    }
    return context
项目:wagtail_room_booking    作者:Tamriel    | 项目源码 | 文件源码
def __str__(self):
        date_format = 'l, %s' % settings.DATE_FORMAT
        return ugettext('Week: %(start)s-%(end)s') % {
            'start': date_filter(self.start, date_format),
            'end': date_filter(self.end, date_format),
        }
项目:wagtail_room_booking    作者:Tamriel    | 项目源码 | 文件源码
def __str__(self):
        date_format = 'l, %s' % settings.DATE_FORMAT
        return ugettext('Day: %(start)s-%(end)s') % {
            'start': date_filter(self.start, date_format),
            'end': date_filter(self.end, date_format),
        }
项目:djanoDoc    作者:JustinChavez    | 项目源码 | 文件源码
def date(value, arg=None):
    """Formats a date according to the given format."""
    if value in (None, ''):
        return ''
    if arg is None:
        arg = settings.DATE_FORMAT
    try:
        return formats.date_format(value, arg)
    except AttributeError:
        try:
            return format(value, arg)
        except AttributeError:
            return ''
项目:django-next-train    作者:bitpixdigital    | 项目源码 | 文件源码
def date(value, arg=None):
    """Formats a date according to the given format."""
    if value in (None, ''):
        return ''
    if arg is None:
        arg = settings.DATE_FORMAT
    try:
        return formats.date_format(value, arg)
    except AttributeError:
        try:
            return format(value, arg)
        except AttributeError:
            return ''
项目:django-wechat-api    作者:crazy-canux    | 项目源码 | 文件源码
def date(value, arg=None):
    """Formats a date according to the given format."""
    if value in (None, ''):
        return ''
    if arg is None:
        arg = settings.DATE_FORMAT
    try:
        return formats.date_format(value, arg)
    except AttributeError:
        try:
            return format(value, arg)
        except AttributeError:
            return ''