| Age | Commit message (Collapse) | Author |
|
provided.
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
|
|
manager.get_queryset() always returns freshly instantiated per-instance
QuerySet which doesn't need subsequent cloning.
Based on work originally done by Anssi Kääriäinen and Tim Graham.
|
|
Thanks Simon Charette for pair programming.
Co-authored-by: Nick Stefan <NickStefan12@gmail.com>
Co-authored-by: Akash Kumar Sen <71623442+Akash-Kumar-Sen@users.noreply.github.com>
Co-authored-by: Simon Charette <charette.s@gmail.com>
|
|
This change ensures that behavior and performance remain consistent when
traversing relationships.
|
|
May your database queries be much reduced with minimal effort.
co-authored-by: Andreas Pelme <andreas@pelme.se>
co-authored-by: Simon Charette <charette.s@gmail.com>
co-authored-by: Jacob Walls <jacobtylerwalls@gmail.com>
|
|
This makes GenericForeignKey more similar to other fields which act as
descriptors, preparing it to add “fetcher protocol” support in a clear and
consistent way.
|
|
Rewrapped long docstrings and block comments to 79 characters + newline
using script from https://github.com/medmunds/autofix-w505.
|
|
order_with_respect_to.
|
|
representations.
Ensured that rel_obj_attr and instance_attr return matching (pk, cls) tuples
in GenericForeignKey.get_prefetch_queryset(), preventing mismatches when
prefetching related objects where pk and get_prep_value() differ. Using
value_to_string() also makes this code compatible with composite primary keys.
|
|
The get_(local|foreign)_related_value methods of GenericRelation must be
reversed because it defines (from|to)_fields and associated related_fields
in the reversed order as it's effectively a reverse GenericForeignKey
itself.
The related value methods must also account for the fact that referenced
primary key values might be stored as a string on the model defining the
GenericForeignKey but as integer on the model defining the GenericRelation.
This is achieved by calling the to_python method of the involved content type
in get_foreign_related_value just like GenericRelatedObjectManager does.
Lastly reverse many-to-one manager's prefetch_related_querysets should use
set_cached_value instead of direct attribute assignment as direct assignment
might are disallowed on ReverseManyToOneDescriptor descriptors. This is likely
something that was missed in f5233dc (refs #32511) when the is_cached guard
was added.
Thanks 1xinghuan for the report.
|
|
get_prefetch_queryset() per deprecation timeline.
|
|
FieldCacheMixin.
FieldCacheMixin is used by related fields to track their cached values.
This work migrates get_cache_name() to be a cached property to optimize
performance by reducing unnecessary function calls when working with
related fields, given that its value remains constant.
Co-authored-by: Simon Charette <charette.s@gmail.com>
Co-authored-by: Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
Co-authored-by: Natalia <124304+nessita@users.noreply.github.com>
|
|
get_attname()/get_attname_column().
|
|
|
|
database setup.
|
|
Co-authored-by: revanthgss <revanthgss@almabase.com>
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
|
|
primary keys with different types.
|
|
Thanks Amir Hadi for the report.
|
|
|
|
methods for related managers.
Bug in 58b27e0dbb3d31ca1438790870b2b51ecdb10500.
|
|
subclasses.
Thanks Shai Berger and Adam Johnson for reviews and the implementation
idea.
|
|
This reverts 4f8c7fd9d91b35e2c2922de4bb50c8c8066cbbc6 and adds
two regression tests:
- test_related_manager_refresh(), and
- test_create_copy_with_m2m().
Thanks joeli for the report.
|
|
Node.create() which has a compatible signature with Node.__init__()
takes in a single `children` argument rather than relying in unpacking
*args in Q.__init__() which calls Node.__init__().
In addition, we were often needing to unpack iterables into *args and
can instead pass a list direct to Node.create().
|
|
|
|
|
|
PathInfo values are ostensibly static over the lifetime of the object
for which they're requested, so the data can be memoized, quickly
amortising the cost over the process' duration.
|
|
Thanks Simon Charette for the implementation idea.
|
|
use non-kwargs initialization.
This prefers non-kwargs construction of dynamically generated Q()
objects to create a single Q() object instead of many and then
combining them, where possible.
|
|
Unused since 3caf957ed5eaa831a485abcb89f27266dbf3e82b.
|
|
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
|
|
Follow up to b7a3a6c9ef0a89625881b47594120bca55fa2e49.
|
|
Thanks Javier Matos Odut for the report.
|
|
|
|
custom ContentType foreign key.
Regression in dffa3e1992562ba60512d96d1eb5859ffff2ceb5.
|
|
content types.
Co-Authored-By: Mariusz Felisiak <felisiak.mariusz@gmail.com>
Thanks Simon Charette for the review.
|
|
|
|
|
|
multi-table inheritance.
|
|
|
|
support.
Thanks Anssi Kääriäinen for contributing to the patch.
|
|
This reverts commit 550cb3a365dee4edfdd1563224d5304de2a57fda
because try/except performs better.
|
|
* Removed all hardcoded logic for _{fieldname}_cache.
* Added an internal API for interacting with the field values cache.
Thanks carljm and MarkusH for support.
|
|
model.
|
|
|
|
Model.pk was added after _get_pk_val() and many places weren't simplified.
|
|
|
|
Thanks Tim Graham for the review.
|
|
|
|
|
|
|