Opened 6 years ago
Last modified 6 years ago
#30201 closed Bug
Form with IntegerRangeField does not validate — at Initial Version
Reported by: | George Tantiras | Owned by: | nobody |
---|---|---|---|
Component: | contrib.postgres | Version: | 2.1 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
In a fresh Django installation:
from django import forms from django.contrib.postgres.forms import IntegerRangeField from psycopg2.extras import NumericRange class A(forms.Form): lifespan = IntegerRangeField(required=True) >>> data = {'lifespan': NumericRange(1918, 1999)} >>> p = A(data=data) >>> p.data {'lifespan': NumericRange(1918, 1999, '[)')} >>> p.is_valid() False >>> p.errors {'lifespan': ['This field is required.']} >>> p.cleaned_data {}
I discovered this behaviour while trying to test a ModelForm with this field.
Note:
See TracTickets
for help on using tickets.