Opened 3 years ago
Last modified 3 years ago
#32967 closed Bug
Buggy Migrations when `flota("nan")` in `Q` objects — at Version 1
Reported by: | Steven Jin | Owned by: | Steven Jin |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 3.2 |
Severity: | Normal | Keywords: | db Q |
Cc: | Steven Jin | Triage Stage: | Unreviewed |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
When creating a CheckConstraint
in the form
class MyModel(Model): x = FloatField() class Meta: constraints = [~CheckConstraint(check=Q(x=float("nan")), name="some constraint")]
This constraint is removed and added back every time python manage.py makemigrations
is run. This is because the inherited __eq__
function of Q
objects does not take into account the fact that float("nan") != float("nan")
.
Note:
See TracTickets
for help on using tickets.