diff options
| author | Marc Tamlyn <marc.tamlyn@gmail.com> | 2015-05-21 20:55:50 +0930 |
|---|---|---|
| committer | Marc Tamlyn <marc.tamlyn@gmail.com> | 2015-06-04 19:29:59 +0100 |
| commit | 7bda2d8ebc7833747363ac837fecb6535c817dcd (patch) | |
| tree | 3f4cc63e0a8420a9da9a5b9e5e52bcbe92ce811b /tests/postgres_tests/models.py | |
| parent | 5987b3c46d5a6948737627d294d95ed54d49eae6 (diff) | |
Fixed #24837 -- field__contained_by=Range
Provide `contained_by` lookups for the equivalent single valued fields
related to the range field types. This acts as the opposite direction to
rangefield__contains.
With thanks to schinckel for the idea and initial tests.
Diffstat (limited to 'tests/postgres_tests/models.py')
| -rw-r--r-- | tests/postgres_tests/models.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/postgres_tests/models.py b/tests/postgres_tests/models.py index 329a91c951..bef77b7b21 100644 --- a/tests/postgres_tests/models.py +++ b/tests/postgres_tests/models.py @@ -60,11 +60,23 @@ if connection.vendor == 'postgresql' and connection.pg_version >= 90200: floats = FloatRangeField(blank=True, null=True) timestamps = DateTimeRangeField(blank=True, null=True) dates = DateRangeField(blank=True, null=True) + + class RangeLookupsModel(PostgreSQLModel): + parent = models.ForeignKey(RangesModel, blank=True, null=True) + integer = models.IntegerField(blank=True, null=True) + big_integer = models.BigIntegerField(blank=True, null=True) + float = models.FloatField(blank=True, null=True) + timestamp = models.DateTimeField(blank=True, null=True) + date = models.DateField(blank=True, null=True) + else: # create an object with this name so we don't have failing imports class RangesModel(object): pass + class RangeLookupsModel(object): + pass + # Only create this model for postgres >= 9.4 if connection.vendor == 'postgresql' and connection.pg_version >= 90400: |
