Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I went for a tiny wrapper on top of
SmallIntegerField
, its convenient because we want the same implementation for a lot of hooks (db_check
,cast_db_type
,db_type_suffix
) but currently, thevalidators
hook is a bit incorrect because it usesSmallIntegerField
ranges (-32768, 32767) instead of (-128, 127).The ranges are stored on
connection.ops.integer_field_range
which makes them a bit difficult to change.My only working idea for now would be to override
validators
with mostly theIntegerField.validators
hook implementation, just altering the min/max values but it's not very clean and might drift.Do you have a recommendation on how to solve this ?
Fixes #1121