Method
to_db_value
(self, value: IntEnum | None | int, instance: type[Model] | Model)
Source from the content-addressed store, hash-verified
| 905 | return value |
| 906 | |
| 907 | def to_db_value(self, value: IntEnum | None | int, instance: type[Model] | Model) -> int | None: |
| 908 | if isinstance(value, IntEnum): |
| 909 | value = int(value.value) |
| 910 | if isinstance(value, int): |
| 911 | value = int(self.enum_type(value)) |
| 912 | self.validate(value) |
| 913 | return value |
| 914 | |
| 915 | |
| 916 | IntEnumType = TypeVar("IntEnumType", bound=IntEnum) |
Callers
nothing calls this directly
Tested by
no test coverage detected