TimeField
class TimeField
A field that converts its input to a datetime.time without timezone.
TimeField(
*,
required: bool = True,
default: Any = None,
after_time: datetime.time | str | None = None,
before_time: datetime.time | str | None = None,
past_time: bool = False,
future_time: bool = False,
offset: int | float = 0,
one_of: collections.abc.Iterable[typing.Any] | None = None,
messages: dict[str, str] | None = None,
_utcnow: datetime.datetime | None = None
)
Bases: Field
| Argument | Description |
|---|---|
required |
Whether the field is required. Defaults to True. |
default |
Default value for the field. Can be a static value or a callable. Defaults to None. |
after_time |
A time that the field value must be after. Defaults to None. |
before_time |
A time that the field value must be before. Defaults to None. past_time:Whether the time must be in the past. Defaults to False. |
future_time |
Whether the time must be in the future. Defaults to False. |
offset |
Timezone offset in hours (floats are allowed) for calculating "now" whenpast_time or future_time are used. Defaults to 0 (UTC timezone). |
one_of |
List of values that the field value must be one of. Defaults to None. |
messages |
Dictionary of error codes to custom error message templates. These override the default error messages for this specific field. Example: . |