summaryrefslogtreecommitdiff
path: root/django/db/models/fields
AgeCommit message (Collapse)Author
2020-07-28[3.1.x] Fixed #31829 -- Used JSONField __contains lookup on key transforms.sage
Backport of 2d8dcba03aae200aaa103ec1e69f0a0038ec2f85 from master
2020-07-28[3.1.x] Fixed #31836 -- Dropped support for JSONField __contains and ↵Mariusz Felisiak
__contained_by lookups on SQLite. The current implementation works only for basic examples without supporting nested structures and doesn't follow "the general principle that the contained object must match the containing object as to structure and data contents, possibly after discarding some non-matching array elements or object key/value pairs from the containing object". Backport of ba691933cee375195c9c50f333dd4b2a3abbb726 from master.
2020-07-28[3.1.x] Fixed #31835 -- Dropped support for JSONField __contains lookup on ↵Mariusz Felisiak
Oracle. The current implementation works only for basic examples without supporting nested structures and doesn't follow "the general principle that the contained object must match the containing object as to structure and data contents, possibly after discarding some non-matching array elements or object key/value pairs from the containing object". Backport of 02447fb133b53ec7d0ff068cc08f06fdf8817ef7 from master
2020-06-26[3.1.x] Fixed #31742 -- Fixed makemigrations crash on ForeignKey to an app ↵Mariusz Felisiak
with mixed case label. Regression in 9e1b6b8a66af4c2197e5b1b41eb9dbb36e4f6502. Thanks Ignacio Santolin for the report. Backport of 62d85a283500e9abb0e1c9ec53c59be468f056a0 from master
2020-06-05[3.1.x] Fixed #31663 -- Made DecimalField.to_python() handle non-numeric ↵Sasha Pachev
invalid values. Backport of 38a21f2d9ed4f556af934498ec6a242f6a20418a from master
2020-05-08Fixed #12990, Refs #27694 -- Added JSONField model field.sage
Thanks to Adam Johnson, Carlton Gibson, Mariusz Felisiak, and Raphael Michel for mentoring this Google Summer of Code 2019 project and everyone else who helped with the patch. Special thanks to Mads Jensen, Nick Pope, and Simon Charette for extensive reviews. Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2020-04-27Removed unnecessary tuple wrapping of single format string argument.François Freitag
2020-04-24Refs #31369 -- Deprecated models.NullBooleanField in favor of ↵Tim Schilling
BooleanField(null=True).
2020-04-08Fixed #28184 -- Allowed using a callable for FileField and ImageField storage.miigotu
2020-03-25Fixed #23916 -- Allowed makemigrations to handle related model name case ↵Adam Johnson
changes. Made autodetector ignore related model name case changes so unnecessary migrations are not created.
2020-02-28Fixed #31310 -- Fixed hints in checks for using intermediate model with ↵Matheus Cunha Motta
ambiguous foreign key. symmetrical=False is not required since 87b1ad6e7351464c60e751b483d9dfce3a2d3382.
2020-02-27Fixed #31185 -- Fixed detecting of unique fields in ForeignKey/ForeignObject ↵Valze
checks when using Meta.constraints.
2020-02-24Fixed #31286 -- Made database specific fields checks databases aware.Taoup
Follow up to 0b83c8cc4db95812f1e15ca19d78614e94cf38dd.
2020-02-18Refs #31282 -- Clarified M2O add/remove/set with PK behaviour.Carlton Gibson
Improved error message for remove() and added tests.
2020-02-17Fixed #31277 -- Relaxed system check of m2m intermediary tables for db_table ↵Xavier Francisco
collision when database routers are installed. Turned the error into a warning when database routers are installed.
2020-02-05Fixed #26813 -- Prevented empty choice in ModelChoiceField with RadioSelect ↵Hasan Ramezani
for fields with blank=False.
2020-01-31Cached ForeignObject.(local/foreign/reverse)_related_fields properties.Adam Johnson
2020-01-31Fixed 31207 -- Prevented references to non-local remote fields in ↵Hasan Ramezani
ForeignKey.to_field. Thanks Simon Charette for the initial patch and review.
2020-01-16Used constant instead of hard-coded value for recursive relationship.Adam Johnson
2020-01-15Fixed #31124 -- Fixed setting of get_FOO_display() when overriding inherited ↵Carlton Gibson
choices. Regression in 2d38eb0ab9f78d68c083a5b78b1eca39027b279a
2020-01-11Fixed #31155 -- Fixed a system check for the longest choice when a named ↵Mariusz Felisiak
group contains only non-string values. Regression in b6251956b69512bf230322bd7a49b629ca8455c6. Thanks Murat Guchetl for the report.
2020-01-09Fixed #21238 -- Fixed restoring attributes when pickling FileField and ↵Hasan Ramezani
ImageField.
2019-12-19Fixed #31095 -- Made RelatedManager.set() preserve existing m2m relations ↵Hasan Ramezani
with an invalid type.
2019-12-03Fixed #31046 -- Allowed RelatedManager.add()/create()/set() to accept ↵Baptiste Mispelon
callable values in through_defaults.
2019-12-03Simplified RelatedManager._add_items() a bit.Baptiste Mispelon
Added early return in RelatedManager._add_items() to decrease an indentation level.
2019-11-22Fixed #8467 -- Prevented crash when adding existent m2m relation with an ↵Simon Charette
invalid type. This was an issue anymore on backends that allows conflicts to be ignored (Refs #19544) as long the provided values were coercible to the expected type. However on the remaining backends that don't support this feature, namely Oracle, this could still result in an IntegrityError. By attempting to coerce the provided values to the expected types in Python beforehand we allow the existing value set intersection in ManyRelatedManager._get_missing_target_ids to prevent the problematic insertion attempts. Thanks Baptiste Mispelon for triaging this old ticket against the current state of the master branch.
2019-11-19Fixed #30987 -- Added models.PositiveBigIntegerField.Caio Ariede
2019-11-05Refs #30095 -- Added Field._choices_is_value().Hasan Ramezani
This allows fields classes to override the validation of choices' values.
2019-11-04Fixed #30931 -- Restored ability to override Model.get_FIELD_display().Carlton Gibson
Thanks Sergey Fedoseev for the implementation idea. Regression in a68ea231012434b522ce45c513d84add516afa60.
2019-10-31Refs #30095 -- Simplified Field._check_choices() a bit.Mariusz Felisiak
Using an internal is_value() hook to check whether Field.choices is iterable is misleading.
2019-10-23Fixed #29919 -- Fixed RelatedOnlyFieldListFilter crash with reverse ↵Dan Moore
relationships.
2019-10-21Fixed #20577 -- Deferred filtering of prefetched related querysets.Alex Aktsipetrov
Added internal interface to QuerySet that allows to defer next filter call till .query is accessed. Used it to optimize prefetch_related(). Thanks Simon Charette for the review.
2019-10-17Refs #12990 -- Moved CheckFieldDefaultMixin to the ↵sage
django.db.models.fields.mixins.
2019-09-24Removed some outdated backwards compatibility imports and misleading comments.Mads Jensen
EmptyResultSet moved in 46509cf13dbf049f75077981c29ef2c60b5a96ab. FieldDoesNotExist moved in 8958170755b37ce346ae5257c1000bd936faa3b0. BoundField and pretty_name moved in 8550161e531a603d57723850fb09c4c9b7ca60b9. EMPTY_VALUES moved in 471596fc1afcb9c6258d317c619eaf5fd394e797. BaseRunserverCommand moved in 5c53e30607014163872e89c221b206992a9acfef.
2019-09-09Refs #29444 -- Allowed returning multiple fields from INSERT statements on ↵Johannes Hoppe
PostgreSQL. Thanks Florian Apolloner, Tim Graham, Simon Charette, Nick Pope, and Mariusz Felisiak for reviews.
2019-09-09Fixed #30757 -- Added a system check to ensure max_length fits the longest ↵Nick Pope
choice.
2019-09-02Refs #28442 -- Adjusted related lookups handling of expression rhs.Simon Charette
Expressions should never be prepared as other Lookup.get_prep_lookup implementations hint at by returning early on the presence of the resolve_expression attribute. The previous solution was only handling lookups against related fields pointing at AutoFields and would break for foreign keys to other fields. It was also causing bidirectional coupling between model fields and expressions which the method level import of OuterRef was a symptom of.
2019-08-20Fixed #29979, Refs #17337 -- Extracted AutoField field logic into a mixin ↵Nick Pope
and refactored AutoFields. This reduces duplication by allowing AutoField, BigAutoField and SmallAutoField to inherit from IntegerField, BigIntegerField and SmallIntegerField respectively. Doing so also allows for enabling the max_length warning check and minimum/maximum value validation for auto fields, as well as providing a mixin that can be used for other possible future auto field types such as a theoretical UUIDAutoField.
2019-08-18Refs #28428 -- Made FileField.upload_to support pathlib.Path.Claude Paroz
2019-08-15Fixed #30449 -- Fixed RelatedFieldListFilter/RelatedOnlyFieldListFilter to ↵zeyneloz
respect model's Meta.ordering. Regression in 6d4e5feb79f7eabe8a0c7c4b87f25b1a7f87ca0b. Co-Authored-By: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2019-08-14Optimized Field.deconstruct() by using elif.Mads Jensen
2019-08-05Fixed #28393 -- Added helpful error messages for invalid ↵Diederik van der Boor
AutoField/FloatField/IntegerField values. Co-authored-by: Diederik van der Boor <vdboor@edoburu.nl> Co-authored-by: Nick Pope <nick.pope@flightdataservices.com>
2019-08-02Fixed #30661 -- Added models.SmallAutoField.Nick Pope
2019-07-27Refs #28147 -- Fixed setting of OneToOne and Foreign Key fields to None when ↵Jon Dufresne
using attnames. Regression in 519016e5f25d7c0a040015724f9920581551cab0.
2019-07-25Fixed #30657 -- Allowed customizing Field's descriptors with a ↵Jon Dufresne
descriptor_class attribute. Allows model fields to override the descriptor class used on the model instance attribute.
2019-07-25Refs #30657 -- Made DeferredAttribute.__init__() to take a field instance ↵Jon Dufresne
instead of a field name.
2019-06-28Fixed #30400 -- Improved typography of user facing strings.Jon Dufresne
Thanks Claude Paroz for assistance with translations.
2019-06-21Fixed #30421 -- Allowed symmetrical intermediate table for self-referential ↵Nadège Michel
ManyToManyField.
2019-05-21Fixed #28147 -- Fixed loss of assigned parent when saving child after parent.Rob
Thanks Erwin Junge for the initial patch.
2019-05-13Fixed #30436 -- Added check that on_delete is callable in ForeignKey and ↵Rob
OneToOneField.