Hasan Ramezani
a3fc24f014
Fixed #31095 -- Made RelatedManager.set() preserve existing m2m relations with an invalid type.
2019-12-19 13:33:05 +01:00
Simon Charette
379bf1a2d4
Fixed #8467 -- Prevented crash when adding existent m2m relation with an 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-22 09:08:10 +01:00
Simon Charette
8cc711999a
Refs #8467 -- Added test for RelatedManager.add()/remove() with an invalid type.
2019-11-22 09:04:03 +01:00
Tobias Kunze
0e2ed4fdd1
Refs #26678 -- Added tests for using the field the relation points to with RelatedManager.add()/remove()/set().
2019-05-07 09:02:06 +02:00
Tobias Kunze
9ac8520fcd
Refs #30325 -- Added tests for using count()/exists() with custom managers and reverse M2M relations.
2019-04-15 12:02:31 +02:00
Mariusz Felisiak
5f7991c42c
Fixed #30325 -- Reverted "Fixed #29725 -- Removed unnecessary join in QuerySet.count() and exists() on a many-to-many relation."
...
This reverts commit 1299421cad
due to
a regression with custom managers.
2019-04-15 12:02:26 +02:00
Jon Dufresne
95b7699ffc
Cleaned up exception message checking in some tests.
2019-03-15 19:27:57 -04:00
Simon Charette
de7f6b51b2
Refs #19544 -- Added a fast path for through additions if supported.
...
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-21 10:20:47 -05:00
Simon Charette
28712d8acf
Refs #19544 -- Ignored auto-created through additions conflicts if supported.
...
This prevents IntegrityError caused by race conditions between missing ids
retrieval and bulk insertions.
2019-02-21 10:20:47 -05:00
oliver
1299421cad
Fixed #29725 -- Removed unnecessary join in QuerySet.count() and exists() on a many-to-many relation.
2018-10-15 11:01:57 -04:00
Rajesh Veeranki
5e1a356060
Fixed typo in tests/many_to_many/tests.py.
2017-10-31 10:21:02 -04:00
Mads Jensen
a51c4de194
Used assertRaisesMessage() to test Django's error messages.
2017-07-29 19:07:23 -04:00
Claude Paroz
d7b9aaa366
Refs #23919 -- Removed encoding preambles and future imports
2017-01-18 09:55:19 +01:00
Tim Graham
ed251246cc
Refs #25550 -- Removed support for direct assignment to the reverse side of a related set.
2017-01-17 20:52:01 -05:00
za
321e94fa41
Refs #27392 -- Removed "Tests that", "Ensures that", etc. from test docstrings.
2016-11-10 21:30:21 -05:00
Yoong Kang Lim
d30febb4e5
Fixed #26706 -- Made RelatedManager modification methods clear prefetch_related() cache.
2016-08-05 13:32:27 -04:00
Tim Graham
5fa4370543
Refs #25550 -- Corrected deprecation message for assigning M2M relations.
2016-07-30 20:50:09 -04:00
Tim Graham
406675b1a0
Fixed #26176 -- Fixed E123 flake8 warnings.
2016-02-05 15:11:07 -05:00
Hasan
3d0dcd7f5a
Refs #26022 -- Used context manager version of assertRaises in tests.
2016-01-29 12:32:18 -05:00
Tim Graham
9c5e272860
Fixed #25550 -- Deprecated direct assignment to the reverse side of a related set.
2015-10-27 07:57:15 -04:00
Aymeric Augustin
e542e81b39
Renamed descriptor classes for related objects.
...
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-21 22:20:42 +02:00
Andriy Sokolovskiy
f7b2978158
Fixed #24156 -- Fixed inherited related name of ManyToManyField.
...
Fixed situation when parent abstract model declares related_name='+',
and child models had an invalid queryset.
2015-05-12 19:14:55 -04:00
Loic Bistuer
c5a77721e2
Merged ManyRelatedObjectsDescriptor and ReverseManyRelatedObjectsDescriptor
...
and made all "many" related objects descriptors inherit from
ForeignRelatedObjectsDescriptor.
2015-02-16 20:40:04 +07:00
Loic Bistuer
71ada3a8e6
Fixed #6707 -- Added RelatedManager.set() and made descriptors' __set__ use it.
...
Thanks Anssi Kääriäinen, Carl Meyer, Collin Anderson, and Tim Graham for the reviews.
2015-02-05 12:45:08 +07:00
Loic Bistuer
da7ab8728c
Fixed mistake in tests from commit 2039908
. Refs #19816 .
2014-03-30 18:48:27 +07:00
Loic Bistuer
20399083f4
Fixed #19816 -- Pre-evaluate querysets used in direct relation assignments.
...
Since assignments on M2M or reverse FK descriptors is composed of a `clear()`,
followed by an `add()`, `clear()` could potentially affect the value of the
assigned queryset before the `add()` step; pre-evaluating it solves the problem.
This patch fixes the issue for ForeignRelatedObjectsDescriptor,
ManyRelatedObjectsDescriptor, and ReverseGenericRelatedObjectsDescriptor.
It completes 6cb6e1 which addressed ReverseManyRelatedObjectsDescriptor.
2014-03-30 15:36:45 +07:00
Loic Bistuer
bc9be72bdc
Fixed transaction handling for a number of operations on related objects.
...
Thanks Anssi and Aymeric for the reviews. Refs #21174 .
2014-03-30 12:13:00 +07:00
Alex Gaynor
9d740eb8b1
Fix all violators of E231
2013-10-26 12:15:03 -07:00
Tim Graham
96d1d4e292
Removed unused local variables in tests.
2013-10-19 08:31:38 -04:00
Claude Paroz
5c1143910e
Removed most of absolute_import imports
...
Should be unneeded with Python 2.7 and up.
Added some unicode_literals along the way.
2013-07-29 20:28:13 +02:00
Florian Apolloner
89f40e3624
Merged regressiontests and modeltests into the test root.
2013-02-26 14:36:57 +01:00