我们从Python开源项目中,提取了以下47个代码示例,用于说明如何使用django.utils.formats.localize_input()。
def _format_value(self, value): if self.is_localized: return formats.localize_input(value) return value
def _format_value(self, value): return formats.localize_input(value, self.format or formats.get_format(self.format_key)[0])
def format_value(self, value): if self.is_localized: return formats.localize_input(value) return value
def format_value(self, value): return formats.localize_input(value, self.format or formats.get_format(self.format_key)[0])
def format_value(self, value): """ Return a value as it should appear when rendered in a template. """ if value == '' or value is None: return None if self.is_localized: return formats.localize_input(value) return force_text(value)
def to_representation(self, value): coerce_to_string = getattr(self, 'coerce_to_string', api_settings.COERCE_DECIMAL_TO_STRING) if not isinstance(value, decimal.Decimal): value = decimal.Decimal(six.text_type(value).strip()) quantized = self.quantize(value) if not coerce_to_string: return quantized if self.localize: return localize_input(quantized) return '{0:f}'.format(quantized)
def _format_value(self, value): if self.is_localized: return formats.localize_input(value) value = [str(e) for e in value] return ','.join(value)
def _format_value(self, value): if self.is_localized and not self.manual_format: return formats.localize_input(value) elif hasattr(value, 'strftime'): value = datetime_safe.new_date(value) return value.strftime(self.format) return value
def _format_value(self, value): if self.is_localized and not self.manual_format: return formats.localize_input(value) elif hasattr(value, 'strftime'): value = datetime_safe.new_datetime(value) return value.strftime(self.format) return value
def _format_value(self, value): if self.is_localized and not self.manual_format: return formats.localize_input(value) elif hasattr(value, 'strftime'): return value.strftime(self.format) return value # Defined at module level so that CheckboxInput is picklable (#17976)
def format_value(self, value): return formats.localize_input(value, "%d/%m/%Y %H:%M")