django/django — pull request #3478 by mjtamlyn (2014-11-06 20:22:27+00:00)
Title: [wip] [contrib.postgres] Range fields

TODO:
- [ ] Custom lookups
- [ ] Validation when passed a tuple
- [ ] Validators
- [ ] Form fields
- [ ] Documentation

Provisional lookup/transform list:
- contains
- contained_by
- overlap
- fully_lt
- fully_gt
- not_lt
- not_gt
- adjacent_to
- lower (bound)
- upper (bound)
- isempty

Arithmetic checks to confirm using tests with F():
- `+` (union)
- `-` (difference)
- `*` (intersection)

Proposed validators:
- Non-empty
- MinValue (applies to lower bound)
- MaxValue (applies to upper bound)

Two basic variants of form fields, one assumes all ranges are `[)` and has just two copies of the base field's inputs. The other also includes two checkboxes labelled "include lower bound" and "include upper bound". To get an empty range, you would enter the same value twice (e.g. (0, 0)).