Clément Escolano
cac94dd8aa
Fixed #33651 -- Added support for prefetching GenericForeignKey.
...
Co-authored-by: revanthgss <revanthgss@almabase.com>
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2023-09-18 13:23:21 +02:00
tschilling
c5808470aa
Fixed #34280 -- Allowed specifying different field values for create operation in QuerySet.update_or_create().
2023-02-14 11:50:35 +01:00
Jon Janzen
321ecb40f4
Fixed #34135 -- Added async-compatible interface to related managers.
2022-11-09 10:32:40 +01:00
Jon Janzen
7b94847e38
Fixed #34139 -- Fixed acreate(), aget_or_create(), and aupdate_or_create() methods for related managers.
...
Bug in 58b27e0dbb
.
2022-11-08 06:20:10 +01:00
Gregor Gärtner
f0c06f8ab7
Refs #33990 -- Renamed TransactionTestCase.assertQuerysetEqual() to assertQuerySetEqual().
...
Co-Authored-By: Michael Howitz <mh@gocept.com>
2022-10-08 08:07:38 +02:00
sarahboyce
cd4da34fc1
Fixed #33004 -- Made saving objects with unsaved GenericForeignKey raise ValueError.
...
This aligns to the behaviour of OneToOneField and ForeignKey fields.
Thanks Jonny Park for the initial patch.
2022-04-21 10:12:28 +02:00
Mariusz Felisiak
7119f40c98
Refs #33476 -- Refactored code to strictly match 88 characters line length.
2022-02-07 20:37:05 +01:00
django-bot
9c19aff7c7
Refs #33476 -- Reformatted code with Black.
2022-02-07 20:37:05 +01:00
Craig Smith
6fa3d02f7f
Refs #32045 -- Added tests for GenericRelatedObjectManager.clear()/remove().
2020-11-06 11:31:21 +01:00
Hasan Ramezani
3f7b327562
Fixed #31235 -- Made assertQuerysetEqual() compare querysets directly.
...
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-11-06 09:24:50 +01:00
Simon Charette
94f63b926f
Refs #31395 -- Relied on setUpTestData() test data isolation in various tests.
2020-05-15 20:22:56 +02:00
Eugene Hatsko
0b013564ef
Fixed #31190 -- Fixed prefetch_related() crash for GenericForeignKey with custom ContentType foreign key.
...
Regression in dffa3e1992
.
2020-01-22 07:54:16 +01:00
can
dffa3e1992
Fixed #30493 -- Fixed prefetch_related() for GenericRelation with different content types.
...
Co-Authored-By: Mariusz Felisiak <felisiak.mariusz@gmail.com>
Thanks Simon Charette for the review.
2019-05-31 18:11:55 +02:00
Tom Forbes
c02d473781
Fixed #29612 -- Added GenericRelation prefetch_related() cache invalidation.
2018-08-17 14:58:45 -04:00
Tim Graham
46d1af2e82
Moved generic_inlineformset_factory() tests to a separate file.
2017-12-28 17:17:47 -05:00
Mads Jensen
a51c4de194
Used assertRaisesMessage() to test Django's error messages.
2017-07-29 19:07:23 -04:00
Anton Samarchyan
4d6584000a
Refs #27745 -- Improved test coverage of contrib.contenttypes.
2017-02-03 14:17:00 -05:00
chillaranand
d6eaf7c018
Refs #23919 -- Replaced super(ClassName, self) with super().
2017-01-25 12:23:46 -05:00
Claude Paroz
d7b9aaa366
Refs #23919 -- Removed encoding preambles and future imports
2017-01-18 09:55:19 +01:00
za
321e94fa41
Refs #27392 -- Removed "Tests that", "Ensures that", etc. from test docstrings.
2016-11-10 21:30:21 -05:00
Bouke Haarsma
31501fb53e
Refs #18599 -- Added a test for assigning a GenericForeignKey in Model.__init__().
...
The issue was fixed by 8a47ba679d
(refs #16508 ).
2016-05-13 21:26:48 -04:00
Michal Petrucha
b9f8635f58
Refs #16508 -- Added invalidation of stale cached instances of GenericForeignKey targets.
2016-05-03 09:29:05 -04:00
Tim Graham
92053acbb9
Fixed E128 flake8 warnings in tests/.
2016-04-08 10:12:33 -04:00
ZachLiuGIS
04e13c8913
Fixed #26179 -- Removed null assignment check for non-nullable foreign key fields.
2016-02-11 10:07:39 -05:00
Hasan
26ad01719d
Refs #26022 -- Replaced six.assertRaisesRegex with assertRaisesMessage as appropriate.
2016-01-29 13:37:33 -05:00
Anssi Kääriäinen
cd0ba8053d
Fixed #12885 -- Fixed queries with GenericRelations to multi-table inheritance child models.
2015-12-14 10:48:01 -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
Tim Graham
4a7b58210d
Refs #19722 -- Added a test for querying generic relations of a parent class.
...
Fixed in c9a96075fa
.
2015-10-08 14:47:35 -04:00
Tim Graham
58c7ff39fb
Refs #13203 , #9501 -- Added a test for generic relations to child models.
...
Fixed in 97774429ae
.
2015-10-02 15:46:58 -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
Dražen Odobašić
b1e33ceced
Fixed #23395 -- Limited line lengths to 119 characters.
2015-09-12 11:40:50 -04:00
Tim Graham
5980b05c1f
Fixed #25160 -- Moved unsaved model instance data loss check to Model.save()
...
This mostly reverts 5643a3b51b
and
81e1a35c36
.
Thanks Carl Meyer for review.
2015-08-10 08:51:32 -04:00
Tim Graham
adc0c4fbac
Fixed #18556 -- Allowed RelatedManager.add() to execute 1 query where possible.
...
Thanks Loic Bistuer for review.
2015-07-28 09:28:25 +07:00
Simon Charette
be67400b47
Refs #24652 -- Used SimpleTestCase where appropriate.
2015-05-20 13:46:13 -04:00
Tim Graham
0ed7d15563
Sorted imports with isort; refs #23860 .
2015-02-06 08:16:28 -05: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
Daniel Pyrathon
fb48eb0581
Fixed #12663 -- Formalized the Model._meta API for retrieving fields.
...
Thanks to Russell Keith-Magee for mentoring this Google Summer of
Code 2014 project and everyone else who helped with the patch!
2015-01-06 19:25:12 -05:00
Tim Graham
30b44cea38
Fixed flake8 warning.
2014-10-08 18:10:50 -04:00
Loic Bistuer
ed37f7e979
Fixed #23611 -- update_or_create failing from a related manager
...
Added update_or_create to RelatedManager, ManyRelatedManager and
GenericRelatedObjectManager.
Added missing get_or_create to GenericRelatedObjectManager.
2014-10-08 03:27:31 +07:00
Anssi Kääriäinen
efe87d3e48
Fixed #22992 -- regression in .filter(generic_fk=...) error message
...
Generic Foreign Keys can't be used as lhs in lookups for historical
reasons. Django 1.6 gave a FieldDoesNotExist exception when using GFKs
as lhs in lookups, but due to regression caused by lookup refactor patch
(20bab2cf9d
) the exception type was
changed to AttributeError.
It might be a good idea to add support for gfk__exact and gfk__in lookups
later on.
Thanks to glicerinu@gmail.com for the report. The code in this commit
was written by Tim Graham.
2014-07-14 10:50:41 -04:00
José L. Patiño
7b064e5390
Split GenericRelationsTests.test_generic_relations into several tests; refs #18586 .
2014-06-01 12:36:32 -04: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
Gabe Jackson
b77f26313c
Fixed #22207 -- Added support for GenericRelation reverse lookups
...
GenericRelation now supports an optional related_query_name argument.
Setting related_query_name adds a relation from the related object back to
the content type for filtering, ordering and other query operations.
Thanks to Loic Bistuer for spotting a couple of important issues in
his review.
2014-03-05 22:37:53 +02:00
Simon Charette
10e3faf191
Fixed #19774 -- Deprecated the contenttypes.generic module.
...
It contained models, forms and admin objects causing undesirable
import side effects. Refs #16368 .
Thanks to Ramiro, Carl and Loïc for the review.
2014-01-26 14:42:30 -05:00
Jason Myers
7a61c68c50
PEP8 cleanup
...
Signed-off-by: Jason Myers <jason@jasonamyers.com>
2013-11-02 23:50:49 -05:00
Alasdair Nicol
b289fcf1bf
Fixed #21288 -- Fixed E126 pep8 warnings
2013-10-21 08:31:30 -04:00
Tim Graham
96d1d4e292
Removed unused local variables in tests.
2013-10-19 08:31:38 -04:00
Alasdair Nicol
a800036981
Fixed #21287 -- Fixed E123 pep8 warnings
2013-10-18 10:07:39 +01:00
Alasdair Nicol
bab9123daa
Fixed #21268 -- Fixed E303 pep8 warnings
2013-10-18 01:46:24 +01:00
Bouke Haarsma
3918eeb9fd
Fixed #7551 -- Made GFK allow None init argument.
...
Thanks SamBull for the report.
2013-10-16 07:03:46 -04:00