summaryrefslogtreecommitdiff
path: root/django/db/models/fields
AgeCommit message (Collapse)Author
2019-11-04[3.0.x] Fixed #30931 -- Restored ability to override Model.get_FIELD_display().Carlton Gibson
Thanks Sergey Fedoseev for the implementation idea. Regression in a68ea231012434b522ce45c513d84add516afa60. Backport of 2d38eb0ab9f78d68c083a5b78b1eca39027b279a from master
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.
2019-05-07Fixed #26678 -- Doc'd that RelatedManager.add()/remove()/set() accepts the ↵Tobias Kunze
field the relation points to.
2019-05-02Fixed #29529 -- Allowed models.fields.FilePathField to accept a callable path.Mykola Kokalko
2019-04-29Simplified Field.contribute_to_class().Jon Dufresne
2019-04-19Fixed #30328 -- Fixed crash of IntegerField.validators when limit_value in a ↵Scott Fitsimones
custom validator is callable.
2019-04-18Fixed #30367 -- Changed "pip install" to "python -m pip install" in docs, ↵Ramiro Morales
comments and hints.
2019-04-16Fixed #30368 -- Fixed prefetch_related() for GenericForeignKey when PK is ↵Vinny Do
also a FK.
2019-04-15Fixed #30325 -- Reverted "Fixed #29725 -- Removed unnecessary join in ↵Mariusz Felisiak
QuerySet.count() and exists() on a many-to-many relation." This reverts commit 1299421cadc4fcf63585f2f88337078e43e660e0 due to a regression with custom managers.
2019-04-14Fixed #30343 -- Fixed prefetch_related() for GenericForeignKey when PK of ↵Mariusz Felisiak
related field is UUIDField.
2019-03-25Fixed #28431 -- Added a system check for BinaryField to prevent strings ↵Hasan Ramezani
defaults. Thanks Claude Paroz for the initial patch.
2019-03-04Fixed #30232 -- Corrected expected format in invalid DurationField error ↵avas9366
message.
2019-02-21Refs #19544 -- Added a fast path for through additions if supported.Simon Charette
The single query insertion path is taken if the backend supports inserts that ignore conflicts and m2m_changed signals don't have to be sent.
2019-02-21Refs #19544 -- Ignored auto-created through additions conflicts if supported.Simon Charette
This prevents IntegrityError caused by race conditions between missing ids retrieval and bulk insertions.
2019-02-21Refs #19544 -- Extracted ManyRelatedManager.add() missing ids logic to a method.Simon Charette
2019-01-30Fixed #30076 -- Added Model.get_FOO_display() even if field's choices are empty.Joshua Cannon
2019-01-27Removed default mode='r' argument from calls to open().Jon Dufresne
2019-01-16Refs #9475 -- Simplified dictionary unpacking.Simon Charette
2019-01-15Refs #9475 -- Fixed typo, used unpacking generalization, and made ↵Nick Pope
through_defaults kwarg-only.
2019-01-15Fixed #9475 -- Allowed RelatedManager.add(), create(), etc. for m2m with a ↵Collin Anderson
through model.
2019-01-14Removed unnecessary string formatting of strings.Jon Dufresne
2019-01-11Moved django.db.migrations.writer.SettingsReference to django.conf.Tim Graham
Reduces the possibility of circular imports.
2019-01-02Used 4 space hanging indent for dictionaries.Tim Graham
Thanks Mariusz Felisiak for auditing.
2018-11-30Fixed #30001 -- Marked UUIDField.description for translation.Prabakaran Kumaresshan
2018-11-23Refs #23801 -- Made integer field max_length warning show correct field type.Nick Pope
2018-11-23Removed redundant BigIntegerField.empty_strings_allowed (already inherited).Nick Pope
2018-11-17Refs #29908 -- Optimized known related objects assignment.Simon Charette
Since CPython implements a C level attrgetter(*attrs) it even outperforms the most common case of a single known related object since the resulting attribute values tuple is built in C.
2018-11-14Fixed #29835 -- Made RelatedFieldListFilter respect ModelAdmin.ordering.Hasan Ramezani
2018-11-08Fixed #29908 -- Fixed setting of foreign key after related set access if ↵Simon Charette
ForeignKey uses to_field. Adjusted known related objects handling of target fields which relies on from and to_fields and has the side effect of fixing a bug bug causing N+1 queries when using reverse foreign objects. Thanks Carsten Fuchs for the report.
2018-10-24Fixed #29869 -- Made UUIDField.to_python() convert integers.Sanyam Khurana
2018-10-22Fixed #27595 -- Made ForeignKey.get_col() follow target chains.Simon Charette
Previously, foreign relationships were followed only one level deep which prevents foreign keys to foreign keys from being resolved appropriately. This was causing issues such as improper database value conversion for UUIDField on SQLite because the resolved expression's output field's internal type wasn't correct. Added tests to make sure unlikely foreign reference cycles don't cause recursion errors. Refs #24343. Thanks oyooyo for the report and Wayne Merry for the investigation.
2018-10-15Fixed #29725 -- Removed unnecessary join in QuerySet.count() and exists() on ↵oliver
a many-to-many relation.
2018-09-25Normalized spelling of "lowercase" and "lowercased".Jon Dufresne
2018-08-28Refs #27795 -- Removed force_bytes()/smart_text() from model fields.Jon Dufresne
2018-08-22Fixed #29698 -- Fixed Field._check_choices() crash on invalid choices.Franck Michea