summaryrefslogtreecommitdiff
path: root/django/contrib/postgres/fields/ranges.py
AgeCommit message (Collapse)Author
2026-03-12Fixed #36727 -- Deprecated Field.get_placeholder in favor of ↵Simon Charette
get_placeholder_sql. The lack of ability of the get_placeholder call chain to return SQL and parameters separated so they can be mogrified by the backend at execution time forced implementations to dangerously interpolate potentially user controlled values. The get_placeholder_sql name was chosen due to its proximity to the previous method, but other options such as Field.as_sql were considered but ultimately rejected due to its different input signature compared to Expression.as_sql that might have lead to confusion. There is a lot of overlap between what Field.get_db_prep_value and get_placeholder_sql do but folding the latter in the former would require changing its return signature to return expression which is a way more invasive change than what is proposed here. Given we always call get_db_prep_value it might still be an avenue worth exploring in the future to offer a publicly documented interface to allow field to take an active part in the compilation chain. Thanks Jacob for the review.
2025-10-13Replaced multi-level relative imports with absolute imports in django/.lyova24
2025-06-18Fixed #32770 -- Added system check to ensure django.contrib.postgres is ↵Clifford Gama
installed when using its features. Added postgres.E005 to validate 'django.contrib.postgres' is in INSTALLED_APPS when using: * PostgreSQL-specific fields (ArrayField, HStoreField, range fields, SearchVectorField), * PostgreSQL indexes (PostgresIndex and all subclasses), and * ExclusionConstraint The check provides immediate feedback during system checks rather than failing later with obscure runtime and database errors. Thanks to Simon Charette and Sarah Boyce for reviews.
2022-12-15Fixed #33308 -- Added support for psycopg version 3.Daniele Varrazzo
Thanks Simon Charette, Tim Graham, and Adam Johnson for reviews. Co-authored-by: Florian Apolloner <florian@apolloner.eu> Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2022-12-12Refs #33308 -- Moved psycopg2 imports to the psycopg_any module.Florian Apolloner
2022-08-09Fixed #33905 -- Fixed CheckConstraint() validation on range fields.David Sanders
Bug in 667105877e6723c6985399803a364848891513cc.
2022-02-07Refs #33476 -- Refactored code to strictly match 88 characters line length.Mariusz Felisiak
2022-02-07Refs #33476 -- Reformatted code with Black.django-bot
2021-11-04Fixed #27147 -- Allowed specifying bounds of tuple inputs for non-discrete ↵Guilherme Martins Crocetti
range fields.
2020-07-15Fixed #30446 -- Resolved Value.output_field for stdlib types.Simon Charette
This required implementing a limited form of dynamic dispatch to combine expressions with numerical output. Refs #26355 should eventually provide a better interface for that.
2020-04-01Refs #12990 -- Moved PostgresSimpleLookup to the ↵Mariusz Felisiak
django.db.models.lookups.PostgresOperatorLookup.
2019-12-05Fixed #31039 -- Added support for contained_by lookup with AutoFields, ↵Hasan Ramezani
SmallIntegerField, and DecimalField.
2019-12-05Refs #31039 -- Removed unnecessary registration of contained_by lookup for ↵Hasan Ramezani
BigIntegerField. It's already registered for IntegerField.
2019-11-14Fixed #29916 -- Added lower_inc, lower_inf, upper_inc, and upper_inf lookups ↵Dulmandakh
for RangeFields. Co-Authored-By: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2019-11-05Fixed #30095 -- Fixed system check for RangeField/ArrayField.choices with ↵Hasan Ramezani
lists and tuples.
2019-09-10Refs #29598 -- Removed FloatRangeField per deprecation timeline.Mariusz Felisiak
2019-07-16Fixed #29824 -- Added support for database exclusion constraints on PostgreSQL.Mads Jensen
Thanks to Nick Pope and Mariusz Felisiak for review. Co-Authored-By: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2019-07-16Refs #29824 -- Added RangeOperators helper class.Mads Jensen
2019-07-13Simplified RangeContainedBy by making it subclass PostgresSimpleLookup.Mariusz Felisiak
2019-07-12Simplified DateTimeRangeContains by making it subclass PostgresSimpleLookup.Mariusz Felisiak
2019-07-10Fixed #30621 -- Fixed crash of __contains lookup for Date/DateTimeRangeField ↵Mariusz Felisiak
when the right hand side is the same type. Thanks Tilman Koschnick for the report and initial patch. Thanks Carlton Gibson the review. Regression in 6b048b364ca1e0e56a0d3815bf2be33ac9998355.
2018-10-02Fixed #29598 -- Deprecated FloatRangeField in favor of DecimalRangeField.Stefano Chiodino
2017-02-07Fixed #26903 -- Fixed __contains lookup for Date/DateTimeRangeField.Mariusz Felisiak
Thanks Mariusz Felisiak and Tim Graham for polishing the patch.
2017-01-25Refs #23919 -- Replaced super(ClassName, self) with super().chillaranand
2017-01-18Refs #23919 -- Removed six.<various>_types usageClaude Paroz
Thanks Tim Graham and Simon Charette for the reviews.
2016-05-04Fixed #22936 -- Obsoleted Field.get_prep_lookup()/get_db_prep_lookup()Claude Paroz
Thanks Tim Graham for completing the initial patch.
2016-04-03Fixed #26101 -- Allowed introspection of base_field.model in RangeFieldanna
Used the same test and fix as in #25867. This required initializing base_field in RangeField.__init__, not when setting the attribute.
2016-02-16Fixed #26215 -- Fixed RangeField/ArrayField serialization with None valuesClaude Paroz
Also added tests for HStoreField and JSONField. Thanks Aleksey Bukin for the report and Tim Graham for the initial patch and the review.
2015-09-21Fixed #24629 -- Unified Transform and Expression APIsJosh Smeaton
2015-07-14Fixed #24716 -- Deprecated Field._get_val_from_obj()Thomas Stephenson
The method duplicates the functionality of Field.value_from_object() and has the additional downside of being a privately named public API method.
2015-06-06Instead of using DjangoJSONEncoder, use base_field's value_to_string.Matthew Somerville
Note this means the serialization of e.g. IntegerRangeField now has strings for lower and upper, so use to_python when they came back in (same behaviour as ArrayField, hopefully, from where I also got the set_attributes_from_name function).
2015-06-05Fixed #24937 -- fix serialization of Date(Time)RangeField.Matthew Somerville
Use the DjangoJSONEncoder so that datetime and date are encoded appropriately.
2015-06-04Fixed #24837 -- field__contained_by=RangeMarc Tamlyn
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.
2015-02-06Sorted imports with isort; refs #23860.Tim Graham
2015-01-10Fixed #24001 -- Added range fields for PostgreSQL.Marc Tamlyn
Added support for PostgreSQL range types to contrib.postgres. - 5 new model fields - 4 new form fields - New validators - Uses psycopg2's range type implementation in python