summaryrefslogtreecommitdiff
path: root/tests/generic_relations
AgeCommit message (Collapse)Author
2026-08-27Fixed #37255 -- Avoided relying on implicit SELECT ordering in tests.viralpraxis
Many (~70) tests assert a specific row order for querysets whose SQL has no ORDER BY. SQL standard does not define that order. On PostgreSQL the rows usually arrive in physical storage order, which on a freshly loaded table matches insertion order -- so these assertions pass by coincidence rather than by contract. That breaks when rows are updated or deleted and the space is reused, or when the planner picks a different access path such as an index scan. A test like this can start failing with no change to Django or to the test itself. The patch made sure that most of these tests do not rely on unspecified unordered selection order.
2026-08-03Refs #28586 -- Renamed RAISE fetch mode to FETCH_RAISE.Jacob Walls
This aims for consistency in the django.db.models namespace. Thanks Natalia Bidart and Simon Charette for the idea.
2026-01-18Applied Black's 2026 stable style.Mariusz Felisiak
https://github.com/psf/black/releases/tag/26.1.0
2025-10-16Refs #28586 -- Copied fetch modes to related objects.Adam Johnson
This change ensures that behavior and performance remain consistent when traversing relationships.
2025-10-16Fixed #28586 -- Added model field fetch modes.Adam Johnson
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>
2025-07-23Refs #36500 -- Rewrapped long docstrings and block comments via a script.django-bot
Rewrapped long docstrings and block comments to 79 characters + newline using script from https://github.com/medmunds/autofix-w505.
2023-09-18Fixed #33651 -- Added support for prefetching GenericForeignKey.Clément Escolano
Co-authored-by: revanthgss <revanthgss@almabase.com> Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2023-02-14Fixed #34280 -- Allowed specifying different field values for create ↵tschilling
operation in QuerySet.update_or_create().
2022-11-09Fixed #34135 -- Added async-compatible interface to related managers.Jon Janzen
2022-11-08Fixed #34139 -- Fixed acreate(), aget_or_create(), and aupdate_or_create() ↵Jon Janzen
methods for related managers. Bug in 58b27e0dbb3d31ca1438790870b2b51ecdb10500.
2022-10-08Refs #33990 -- Renamed TransactionTestCase.assertQuerysetEqual() to ↵Gregor Gärtner
assertQuerySetEqual(). Co-Authored-By: Michael Howitz <mh@gocept.com>
2022-04-21Fixed #33004 -- Made saving objects with unsaved GenericForeignKey raise ↵sarahboyce
ValueError. This aligns to the behaviour of OneToOneField and ForeignKey fields. Thanks Jonny Park for the initial patch.
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
2020-11-06Refs #32045 -- Added tests for GenericRelatedObjectManager.clear()/remove().Craig Smith
2020-11-06Fixed #31235 -- Made assertQuerysetEqual() compare querysets directly.Hasan Ramezani
This also replaces assertQuerysetEqual() to assertSequenceEqual()/assertCountEqual() where appropriate. Co-authored-by: Peter Inglesby <peter.inglesby@gmail.com> Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2020-09-28Fixed #32042 -- Improved error messages for the number of submitted forms in ↵meghanabhange
formsets.
2020-08-18Refs #9061 -- Allowed GenericInlineFormSet to disable deleting extra forms.Mariusz Felisiak
Follow up to 162765d6c3182e36095d29543e21b44b908625fc.
2020-08-18Refs #20347 -- Allowed customizing the maximum number of instantiated forms ↵Mariusz Felisiak
in generic_inlineformset_factory(). Follow up to 433dd737f94b09043f64b873b0ac067b3f97364b.
2020-05-15Refs #31395 -- Relied on setUpTestData() test data isolation in various tests.Simon Charette
2020-01-22Fixed #31190 -- Fixed prefetch_related() crash for GenericForeignKey with ↵Eugene Hatsko
custom ContentType foreign key. Regression in dffa3e1992562ba60512d96d1eb5859ffff2ceb5.
2019-05-31Fixed #30493 -- Fixed prefetch_related() for GenericRelation with different ↵can
content types. Co-Authored-By: Mariusz Felisiak <felisiak.mariusz@gmail.com> Thanks Simon Charette for the review.
2018-08-17Fixed #29612 -- Added GenericRelation prefetch_related() cache invalidation.Tom Forbes
2018-01-21Fixed #29038 -- Removed closing slash from HTML void tags.Jon Dufresne
2017-12-30Fixed #14642 -- Fixed generic inline formsets crash when using save_as_new=True.Tomer Chachamu
2017-12-28Moved generic_inlineformset_factory() tests to a separate file.Tim Graham
2017-07-29Used assertRaisesMessage() to test Django's error messages.Mads Jensen
2017-02-03Refs #27745 -- Improved test coverage of contrib.contenttypes.Anton Samarchyan
2017-01-25Refs #23919 -- Replaced super(ClassName, self) with super().chillaranand
2017-01-18Refs #23919 -- Removed python_2_unicode_compatible decorator usageClaude Paroz
2017-01-18Refs #23919 -- Removed encoding preambles and future importsClaude Paroz
2016-11-10Refs #27392 -- Removed "Tests that", "Ensures that", etc. from test docstrings.za
2016-05-13Refs #18599 -- Added a test for assigning a GenericForeignKey in ↵Bouke Haarsma
Model.__init__(). The issue was fixed by 8a47ba679d2da0dee74671a53ba0cd918b433e34 (refs #16508).
2016-05-03Refs #16508 -- Added invalidation of stale cached instances of ↵Michal Petrucha
GenericForeignKey targets.
2016-04-08Fixed E128 flake8 warnings in tests/.Tim Graham
2016-02-11Fixed #26179 -- Removed null assignment check for non-nullable foreign key ↵ZachLiuGIS
fields.
2016-01-29Refs #26022 -- Replaced six.assertRaisesRegex with assertRaisesMessage as ↵Hasan
appropriate.
2015-12-14Fixed #12885 -- Fixed queries with GenericRelations to multi-table ↵Anssi Kääriäinen
inheritance child models.
2015-10-27Fixed #25550 -- Deprecated direct assignment to the reverse side of a ↵Tim Graham
related set.
2015-10-08Refs #19722 -- Added a test for querying generic relations of a parent class.Tim Graham
Fixed in c9a96075fa02b6d52bec748ffdfb413688a15774.
2015-10-02Refs #13203, #9501 -- Added a test for generic relations to child models.Tim Graham
Fixed in 97774429aeb54df4c09895c07cd1b09e70201f7d.
2015-09-21Renamed descriptor classes for related objects.Aymeric Augustin
The old names were downright confusing. Some seemed to mean the opposite of what the class actually did. The new names follow a consistent nomenclature: (Forward|Reverse)(ManyToOne|OneToOne|ManyToMany)Descriptor. I mentioned combinations that do not exist in the docstring in order to help people who would search for them in the code base.
2015-09-12Fixed #23395 -- Limited line lengths to 119 characters.Dražen Odobašić
2015-08-10Fixed #25160 -- Moved unsaved model instance data loss check to Model.save()Tim Graham
This mostly reverts 5643a3b51be338196d0b292d5626ad43648448d3 and 81e1a35c364e5353d2bf99368ad30a4184fbb653. Thanks Carl Meyer for review.
2015-07-28Fixed #18556 -- Allowed RelatedManager.add() to execute 1 query where possible.Tim Graham
Thanks Loic Bistuer for review.
2015-07-27Fixed #21127 -- Started deprecation toward requiring on_delete for ↵Flavio Curella
ForeignKey/OneToOneField
2015-05-20Refs #24652 -- Used SimpleTestCase where appropriate.Simon Charette
2015-02-06Sorted imports with isort; refs #23860.Tim Graham
2015-02-05Fixed #6707 -- Added RelatedManager.set() and made descriptors' __set__ use it.Loic Bistuer
Thanks Anssi Kääriäinen, Carl Meyer, Collin Anderson, and Tim Graham for the reviews.
2015-01-16Fixed #24099 -- Removed contenttype.name deprecated fieldClaude Paroz
This finsishes the work started on #16803. Thanks Simon Charette, Tim Graham and Collin Anderson for the reviews.