You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 24, 2021. It is now read-only.
When using *RangeField in specific PostgreSQL fields, the bounds are always defined as [) (inclusive first number, exclusive last number). This can be changed in the database, but Django does not support changing those bounds.
So, when users enter in data in the administration panel, erroneous behavior can occur.
Say for example, a bat only has one pup per year. That would be entered in as 1 - 1 in the Wagtail interface. Stored in the database, that's [1, 1), which is an invalid range, and defaults to null for the value. This shouldn't be the case.
One solution would be to break it up into two separate fields (min/max_(size|pups)), and create a serializer that ties the two fields for the API, like
"pups": {
"min": 1
"max": 1
}
The text was updated successfully, but these errors were encountered:
The way to provide a custom validator for this (min_size <= max_size) would be to implement a clean() method on it. Probably not worth the trouble, unless tests are written for model validation.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
When using
*RangeField
in specific PostgreSQL fields, the bounds are always defined as [) (inclusive first number, exclusive last number). This can be changed in the database, but Django does not support changing those bounds.So, when users enter in data in the administration panel, erroneous behavior can occur.
Say for example, a bat only has one pup per year. That would be entered in as 1 - 1 in the Wagtail interface. Stored in the database, that's [1, 1), which is an invalid range, and defaults to
null
for the value. This shouldn't be the case.One solution would be to break it up into two separate fields (min/max_(size|pups)), and create a serializer that ties the two fields for the API, like
The text was updated successfully, but these errors were encountered: