Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tiny integer field #1123

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

UnknownPlatypus
Copy link

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, the validators hook is a bit incorrect because it uses SmallIntegerField 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 the IntegerField.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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add TinyIntegerField and PositiveTinyIntegerField
1 participant