| Age | Commit message (Collapse) | Author |
|
Edit permissions were still checked as part of ordinary form validation,
but because GenericInlineModelAdmin overrides get_formset(), it lacked
InlineModelAdmin's dynamic DeleteProtectedModelForm.has_changed() logic
for checking permissions server-side, leaving the add case unaddressed.
This change reimplements the relevant part of InlineModelAdmin.get_formset().
Thanks N05ec@LZU-DSLab for the report, and Natalia Bidart,
Markus Holtermann, and Simon Charette for reviews.
|
|
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.
|
|
ContentTypes.
|
|
model_class() is None.
Updated ContentType.app_labeled_name to include the app_label in its string representation.
This removed ambiguity for content types whose models were not present in the current codebase
(for example, when multiple applications share the same database).
Adjusted related tests to reflect the new representation.
|
|
Forwardport of 00575b79312c719a6b37035067095e2d679bb5d7 from stable/6.0.x.
|
|
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.
|
|
Forwardport of 2a2936c3e6444a0f37156773ca405cedaf28dea7 from stable/5.2.x.
|
|
Since 142ab6846ac09d6d401e26fc8b6b988a583ac0f5
get_contenttypes_and_models() function was only used in this module and
we only needed the model names, not the content type objects themselves.
|
|
Rewrapped long docstrings and block comments to 79 characters + newline
using script from https://github.com/medmunds/autofix-w505.
|
|
The documentation[0] encourages users to write functions without a
default for `app_configs`, and checks are always passed the argument.
[0] https://docs.djangoproject.com/en/5.2/topics/checks/
|
|
order_with_respect_to.
|
|
object_id for a UUIDField pk.
|
|
Forwardport of cc31b389a11559396fc039511c0dc567d9ade469 from stable/5.2.x.
|
|
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.
|
|
Forwardport of e245f62d0052d7b15fa2a60926d59eeeefee9be1 from stable/5.1.x.
|
|
is set.
|
|
Forwardport of 380c6e6ddd7890fbe65826873579ef6e3af0c07d from stable/5.1.x.
|
|
in CreateModel migrations.
Thank you to Csirmaz Bendegúz for the report and Simon Charettes for the review.
|
|
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.
|
|
Forwardport of 3cc35aafabb1523c39332ee83e769b085ed3d923 from stable/5.0.x.
|
|
|
|
Forwardport of 8e1b820fa10d16664beb5d1ca2f5671891da1704 from stable/5.0.x.
|
|
Co-authored-by: revanthgss <revanthgss@almabase.com>
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
|
|
primary keys with different types.
|
|
Forwardport of fa687719321329f4e5017b7fc1b8cadae3c63c32 from stable/4.2.x.
|
|
|
|
Black 23.1.0 is released which, as the first release of the year,
introduces the 2023 stable style. This incorporates most of last year's
preview style.
https://github.com/psf/black/releases/tag/23.1.0
|
|
|
|
Updated Bulgarian, Esperanto, Hungarian, Japanese, Macedonian, Persian,
Portuguese (Brazil), Russian, Spanish, and Turkmen translations.
Forwardport of 46b28bbe151282e9198b719d00f84b48c92606ba from stable/4.1.x.
|
|
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.
|
|
in migrations.
Co-authored-by: Heraldo Lucena <23155511+HMaker@users.noreply.github.com>
|
|
This reverts 4f8c7fd9d91b35e2c2922de4bb50c8c8066cbbc6 and adds
two regression tests:
- test_related_manager_refresh(), and
- test_create_copy_with_m2m().
Thanks joeli for the report.
|
|
This also fixes related i18n tests.
Forwardport of a3bab9332416f655c6ae0fa306c94f7f52e7398d from stable/4.1.x.
Co-authored-by: Claude Paroz <claude@2xlibre.net>
|
|
|
|
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().
|
|
Q._connector defaults to Q.AND.
Follow up to 859a87d873ce7152af73ab851653b4e1c3ffea4c.
|