Python wtforms.fields 模块,DateTimeField() 实例源码

我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用wtforms.fields.DateTimeField()

项目:Sci-Finder    作者:snverse    | 项目源码 | 文件源码
def conv_DateTime(self, field_args, **extra):
        return f.DateTimeField(**field_args)
项目:Sci-Finder    作者:snverse    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        if not has_timezone:
            raise ImportError('DateTimeField requires Django >= 1.5')

        super(DateTimeField, self).__init__(*args, **kwargs)
项目:Sci-Finder    作者:snverse    | 项目源码 | 文件源码
def process_formdata(self, valuelist):
        super(DateTimeField, self).process_formdata(valuelist)

        date = self.data

        if settings.USE_TZ and date is not None and timezone.is_naive(date):
            current_timezone = timezone.get_current_timezone()
            self.data = timezone.make_aware(date, current_timezone)
项目:Sci-Finder    作者:snverse    | 项目源码 | 文件源码
def _value(self):
        date = self.data

        if settings.USE_TZ and isinstance(date, datetime.datetime) and timezone.is_aware(date):
            self.data = timezone.localtime(date)

        return super(DateTimeField, self)._value()
项目:Sci-Finder    作者:snverse    | 项目源码 | 文件源码
def conv_TimeField(self, model, field, kwargs):
        def time_only(obj):
            try:
                return obj.time()
            except AttributeError:
                return obj
        kwargs['filters'].append(time_only)
        return f.DateTimeField(format='%H:%M:%S', **kwargs)
项目:Sci-Finder    作者:snverse    | 项目源码 | 文件源码
def convert_TimeProperty(model, prop, kwargs):
    """Returns a form field for a ``db.TimeProperty``."""
    if prop.auto_now or prop.auto_now_add:
        return None

    kwargs.setdefault('format', '%H:%M:%S')
    return f.DateTimeField(**kwargs)
项目:Sci-Finder    作者:snverse    | 项目源码 | 文件源码
def convert_DateTimeProperty(self, model, prop, kwargs):
        """Returns a form field for a ``ndb.DateTimeProperty``."""
        if prop._auto_now or prop._auto_now_add:
            return None

        return f.DateTimeField(format='%Y-%m-%d %H:%M:%S', **kwargs)
项目:Sci-Finder    作者:snverse    | 项目源码 | 文件源码
def convert_TimeProperty(self, model, prop, kwargs):
        """Returns a form field for a ``ndb.TimeProperty``."""
        if prop._auto_now or prop._auto_now_add:
            return None

        return f.DateTimeField(format='%H:%M:%S', **kwargs)
项目:Sci-Finder    作者:snverse    | 项目源码 | 文件源码
def conv_DateTime(self, field_args, **extra):
        return f.DateTimeField(**field_args)
项目:Sci-Finder    作者:snverse    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        if not has_timezone:
            raise ImportError('DateTimeField requires Django >= 1.5')

        super(DateTimeField, self).__init__(*args, **kwargs)
项目:Sci-Finder    作者:snverse    | 项目源码 | 文件源码
def _value(self):
        date = self.data

        if settings.USE_TZ and isinstance(date, datetime.datetime) and timezone.is_aware(date):
            self.data = timezone.localtime(date)

        return super(DateTimeField, self)._value()
项目:Sci-Finder    作者:snverse    | 项目源码 | 文件源码
def conv_TimeField(self, model, field, kwargs):
        def time_only(obj):
            try:
                return obj.time()
            except AttributeError:
                return obj
        kwargs['filters'].append(time_only)
        return f.DateTimeField(format='%H:%M:%S', **kwargs)
项目:Sci-Finder    作者:snverse    | 项目源码 | 文件源码
def convert_DateTimeProperty(model, prop, kwargs):
    """Returns a form field for a ``db.DateTimeProperty``."""
    if prop.auto_now or prop.auto_now_add:
        return None

    kwargs.setdefault('format', '%Y-%m-%d %H:%M:%S')
    return f.DateTimeField(**kwargs)
项目:Sci-Finder    作者:snverse    | 项目源码 | 文件源码
def convert_TimeProperty(model, prop, kwargs):
    """Returns a form field for a ``db.TimeProperty``."""
    if prop.auto_now or prop.auto_now_add:
        return None

    kwargs.setdefault('format', '%H:%M:%S')
    return f.DateTimeField(**kwargs)
项目:Sci-Finder    作者:snverse    | 项目源码 | 文件源码
def convert_DateTimeProperty(self, model, prop, kwargs):
        """Returns a form field for a ``ndb.DateTimeProperty``."""
        if prop._auto_now or prop._auto_now_add:
            return None

        return f.DateTimeField(format='%Y-%m-%d %H:%M:%S', **kwargs)
项目:flasky    作者:RoseOu    | 项目源码 | 文件源码
def conv_DateTime(self, field_args, **extra):
        return f.DateTimeField(**field_args)
项目:flasky    作者:RoseOu    | 项目源码 | 文件源码
def conv_TimeField(self, model, field, kwargs):
        def time_only(obj):
            try:
                return obj.time()
            except AttributeError:
                return obj
        kwargs['filters'].append(time_only)
        return f.DateTimeField(format='%H:%M:%S', **kwargs)
项目:flasky    作者:RoseOu    | 项目源码 | 文件源码
def convert_DateTimeProperty(model, prop, kwargs):
    """Returns a form field for a ``db.DateTimeProperty``."""
    if prop.auto_now or prop.auto_now_add:
        return None

    kwargs.setdefault('format', '%Y-%m-%d %H:%M:%S')
    return f.DateTimeField(**kwargs)
项目:flasky    作者:RoseOu    | 项目源码 | 文件源码
def convert_TimeProperty(model, prop, kwargs):
    """Returns a form field for a ``db.TimeProperty``."""
    if prop.auto_now or prop.auto_now_add:
        return None

    kwargs.setdefault('format', '%H:%M:%S')
    return f.DateTimeField(**kwargs)
项目:flasky    作者:RoseOu    | 项目源码 | 文件源码
def convert_DateTimeProperty(self, model, prop, kwargs):
        """Returns a form field for a ``ndb.DateTimeProperty``."""
        if prop._auto_now or prop._auto_now_add:
            return None

        return f.DateTimeField(format='%Y-%m-%d %H:%M:%S', **kwargs)
项目:oa_qian    作者:sunqb    | 项目源码 | 文件源码
def conv_DateTime(self, field_args, **extra):
        return f.DateTimeField(**field_args)
项目:oa_qian    作者:sunqb    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        if not has_timezone:
            raise ImportError('DateTimeField requires Django >= 1.5')

        super(DateTimeField, self).__init__(*args, **kwargs)
项目:oa_qian    作者:sunqb    | 项目源码 | 文件源码
def process_formdata(self, valuelist):
        super(DateTimeField, self).process_formdata(valuelist)

        date = self.data

        if settings.USE_TZ and date is not None and timezone.is_naive(date):
            current_timezone = timezone.get_current_timezone()
            self.data = timezone.make_aware(date, current_timezone)
项目:oa_qian    作者:sunqb    | 项目源码 | 文件源码
def _value(self):
        date = self.data

        if settings.USE_TZ and isinstance(date, datetime.datetime) and timezone.is_aware(date):
            self.data = timezone.localtime(date)

        return super(DateTimeField, self)._value()
项目:oa_qian    作者:sunqb    | 项目源码 | 文件源码
def conv_TimeField(self, model, field, kwargs):
        def time_only(obj):
            try:
                return obj.time()
            except AttributeError:
                return obj
        kwargs['filters'].append(time_only)
        return f.DateTimeField(format='%H:%M:%S', **kwargs)
项目:oa_qian    作者:sunqb    | 项目源码 | 文件源码
def convert_TimeProperty(model, prop, kwargs):
    """Returns a form field for a ``db.TimeProperty``."""
    if prop.auto_now or prop.auto_now_add:
        return None

    kwargs.setdefault('format', '%H:%M:%S')
    return f.DateTimeField(**kwargs)
项目:oa_qian    作者:sunqb    | 项目源码 | 文件源码
def convert_DateTimeProperty(self, model, prop, kwargs):
        """Returns a form field for a ``ndb.DateTimeProperty``."""
        if prop._auto_now or prop._auto_now_add:
            return None

        return f.DateTimeField(format='%Y-%m-%d %H:%M:%S', **kwargs)
项目:oa_qian    作者:sunqb    | 项目源码 | 文件源码
def convert_TimeProperty(self, model, prop, kwargs):
        """Returns a form field for a ``ndb.TimeProperty``."""
        if prop._auto_now or prop._auto_now_add:
            return None

        return f.DateTimeField(format='%H:%M:%S', **kwargs)
项目:chihu    作者:yelongyu    | 项目源码 | 文件源码
def conv_DateTime(self, field_args, **extra):
        return f.DateTimeField(**field_args)
项目:chihu    作者:yelongyu    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        if not has_timezone:
            raise ImportError('DateTimeField requires Django >= 1.5')

        super(DateTimeField, self).__init__(*args, **kwargs)
项目:chihu    作者:yelongyu    | 项目源码 | 文件源码
def process_formdata(self, valuelist):
        super(DateTimeField, self).process_formdata(valuelist)

        date = self.data

        if settings.USE_TZ and date is not None and timezone.is_naive(date):
            current_timezone = timezone.get_current_timezone()
            self.data = timezone.make_aware(date, current_timezone)
项目:chihu    作者:yelongyu    | 项目源码 | 文件源码
def _value(self):
        date = self.data

        if settings.USE_TZ and isinstance(date, datetime.datetime) and timezone.is_aware(date):
            self.data = timezone.localtime(date)

        return super(DateTimeField, self)._value()
项目:chihu    作者:yelongyu    | 项目源码 | 文件源码
def conv_TimeField(self, model, field, kwargs):
        def time_only(obj):
            try:
                return obj.time()
            except AttributeError:
                return obj
        kwargs['filters'].append(time_only)
        return f.DateTimeField(format='%H:%M:%S', **kwargs)
项目:chihu    作者:yelongyu    | 项目源码 | 文件源码
def convert_TimeProperty(model, prop, kwargs):
    """Returns a form field for a ``db.TimeProperty``."""
    if prop.auto_now or prop.auto_now_add:
        return None

    kwargs.setdefault('format', '%H:%M:%S')
    return f.DateTimeField(**kwargs)
项目:chihu    作者:yelongyu    | 项目源码 | 文件源码
def convert_DateTimeProperty(self, model, prop, kwargs):
        """Returns a form field for a ``ndb.DateTimeProperty``."""
        if prop._auto_now or prop._auto_now_add:
            return None

        return f.DateTimeField(format='%Y-%m-%d %H:%M:%S', **kwargs)
项目:chihu    作者:yelongyu    | 项目源码 | 文件源码
def convert_TimeProperty(self, model, prop, kwargs):
        """Returns a form field for a ``ndb.TimeProperty``."""
        if prop._auto_now or prop._auto_now_add:
            return None

        return f.DateTimeField(format='%H:%M:%S', **kwargs)
项目:pyetje    作者:rorlika    | 项目源码 | 文件源码
def conv_DateTime(self, field_args, **extra):
        return f.DateTimeField(**field_args)
项目:pyetje    作者:rorlika    | 项目源码 | 文件源码
def conv_TimeField(self, model, field, kwargs):
        def time_only(obj):
            try:
                return obj.time()
            except AttributeError:
                return obj
        kwargs['filters'].append(time_only)
        return f.DateTimeField(format='%H:%M:%S', **kwargs)
项目:pyetje    作者:rorlika    | 项目源码 | 文件源码
def convert_DateTimeProperty(model, prop, kwargs):
    """Returns a form field for a ``db.DateTimeProperty``."""
    if prop.auto_now or prop.auto_now_add:
        return None

    kwargs.setdefault('format', '%Y-%m-%d %H:%M:%S')
    return f.DateTimeField(**kwargs)
项目:pyetje    作者:rorlika    | 项目源码 | 文件源码
def convert_TimeProperty(model, prop, kwargs):
    """Returns a form field for a ``db.TimeProperty``."""
    if prop.auto_now or prop.auto_now_add:
        return None

    kwargs.setdefault('format', '%H:%M:%S')
    return f.DateTimeField(**kwargs)
项目:pyetje    作者:rorlika    | 项目源码 | 文件源码
def convert_DateTimeProperty(self, model, prop, kwargs):
        """Returns a form field for a ``ndb.DateTimeProperty``."""
        if prop._auto_now or prop._auto_now_add:
            return None

        return f.DateTimeField(format='%Y-%m-%d %H:%M:%S', **kwargs)
项目:FileStoreGAE    作者:liantian-cn    | 项目源码 | 文件源码
def conv_DateTime(self, field_args, **extra):
        return f.DateTimeField(**field_args)
项目:FileStoreGAE    作者:liantian-cn    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        if not has_timezone:
            raise ImportError('DateTimeField requires Django >= 1.5')

        super(DateTimeField, self).__init__(*args, **kwargs)
项目:FileStoreGAE    作者:liantian-cn    | 项目源码 | 文件源码
def process_formdata(self, valuelist):
        super(DateTimeField, self).process_formdata(valuelist)

        date = self.data

        if settings.USE_TZ and date is not None and timezone.is_naive(date):
            current_timezone = timezone.get_current_timezone()
            self.data = timezone.make_aware(date, current_timezone)
项目:FileStoreGAE    作者:liantian-cn    | 项目源码 | 文件源码
def _value(self):
        date = self.data

        if settings.USE_TZ and isinstance(date, datetime.datetime) and timezone.is_aware(date):
            self.data = timezone.localtime(date)

        return super(DateTimeField, self)._value()
项目:FileStoreGAE    作者:liantian-cn    | 项目源码 | 文件源码
def conv_TimeField(self, model, field, kwargs):
        def time_only(obj):
            try:
                return obj.time()
            except AttributeError:
                return obj
        kwargs['filters'].append(time_only)
        return f.DateTimeField(format='%H:%M:%S', **kwargs)
项目:FileStoreGAE    作者:liantian-cn    | 项目源码 | 文件源码
def convert_TimeProperty(model, prop, kwargs):
    """Returns a form field for a ``db.TimeProperty``."""
    if prop.auto_now or prop.auto_now_add:
        return None

    kwargs.setdefault('format', '%H:%M:%S')
    return f.DateTimeField(**kwargs)
项目:FileStoreGAE    作者:liantian-cn    | 项目源码 | 文件源码
def convert_DateTimeProperty(self, model, prop, kwargs):
        """Returns a form field for a ``ndb.DateTimeProperty``."""
        if prop._auto_now or prop._auto_now_add:
            return None

        return f.DateTimeField(format='%Y-%m-%d %H:%M:%S', **kwargs)
项目:FileStoreGAE    作者:liantian-cn    | 项目源码 | 文件源码
def convert_TimeProperty(self, model, prop, kwargs):
        """Returns a form field for a ``ndb.TimeProperty``."""
        if prop._auto_now or prop._auto_now_add:
            return None

        return f.DateTimeField(format='%H:%M:%S', **kwargs)
项目:python-group-proj    作者:Sharcee    | 项目源码 | 文件源码
def conv_DateTime(self, field_args, **extra):
        return f.DateTimeField(**field_args)