MCPcopy
hub / github.com/django/django / compress

Method compress

django/forms/fields.py:1269–1283  ·  view source on GitHub ↗
(self, data_list)

Source from the content-addressed store, hash-verified

1267 super().__init__(fields, **kwargs)
1268
1269 def compress(self, data_list):
1270 if data_list:
1271 # Raise a validation error if time or date is empty
1272 # (possible if SplitDateTimeField has required=False).
1273 if data_list[0] in self.empty_values:
1274 raise ValidationError(
1275 self.error_messages["invalid_date"], code="invalid_date"
1276 )
1277 if data_list[1] in self.empty_values:
1278 raise ValidationError(
1279 self.error_messages["invalid_time"], code="invalid_time"
1280 )
1281 result = datetime.datetime.combine(*data_list)
1282 return from_current_timezone(result)
1283 return None
1284
1285
1286class GenericIPAddressField(CharField):

Callers

nothing calls this directly

Calls 3

ValidationErrorClass · 0.90
from_current_timezoneFunction · 0.90
combineMethod · 0.80

Tested by

no test coverage detected