summaryrefslogtreecommitdiff
path: root/tests/get_or_create
AgeCommit message (Collapse)Author
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.
2025-01-15Refs #29499 -- Fixed race condition in update_or_create() test.Simon Charette
The usage of time.sleep() could result in the update_or_create() thread winning the race to create the row if the backend takes a while to create a new connection in the main thread. Relying on threading.Event ensures that the flow of execution is systematically yield back and forth between the main thread and the thread in charge of performing the background update_or_create().
2024-02-21Removed obsolete test_get_or_create_raises_IntegrityError_plus_traceback() test.Mariusz Felisiak
This test was added in 31b1cbc623c246570e7301c0334df938d840638f, but is no longer needed, as the fix was reverted in 746caf3ef821dbf7588797cb2600fa81b9df9d1d without any consequences, so it now tests Python behavior rather than Django. Moreover, traceback introspection is problematic for .pyc-only installations.
2023-02-14Fixed #34280 -- Allowed specifying different field values for create ↵tschilling
operation in QuerySet.update_or_create().
2023-02-01Refs #33476 -- Applied Black's 2023 stable style.David Smith
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
2022-10-29Corrected test_update_or_create_with_model_property_defaults test.Msvstl
2022-09-30Fixed #32095 -- Made QuerySet.update_or_create() save only fields passed in ↵sarahboyce
defaults or with custom pre_save(). Thanks Florian Apolloner for the initial patch.
2022-09-27Added tests for QuerySet.update_or_create() with multi-table inheritance.sarahboyce
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-04-30Removed unused __str__() methods in tests models.Mariusz Felisiak
Follow up to 6461583b6cc257d25880ef9a9fd7e2125ac53ce1.
2018-11-27Switched setUp() to setUpTestData() where possible in Django's tests.Simon Charette
2018-08-02Fixed #29499 -- Fixed race condition in QuerySet.update_or_create().Michael Sanders
A race condition happened when the object didn't already exist and another process/thread created the object before update_or_create() did and then attempted to update the object, also before update_or_create() saved the object. The update by the other process/thread could be lost.
2018-07-16Fixed #29413 -- Prevented evaluation of ↵Viktor Danyliuk
QuerySet.get_or_create()/update_or_create() defaults unless needed. Removed the logic added in 81e05a418dc6f347d9627373288e773c477a9fe0 which was obsolete since dbffffa7dc95fc62cbecfd00284bde62ee796f48.
2018-02-15Fixed #29126 -- Doc'd the behavior of QuerySet.update_or_create() with ↵Tim Graham
manually specified pks.
2017-05-27Fixed #28222 -- Allowed settable properties in ↵Alex
QuerySet.update_or_create()/get_or_create() defaults.
2017-05-10Decreased max_length for char fields unless absolutely needed. (#8485)Florian Apolloner
2017-05-01Refs #27795 -- Reworked get_or_create test erroneously mixing bytes and str.Jon Dufresne
As CharField.to_python() now always calls str(), assigning bytes to a CharField is no longer correct usage. Doing so results in a warning: django/db/models/fields/__init__.py:1061: BytesWarning: str() on a bytes instance Use a unique constraint violation to trigger the database error instead. Warning introduced in 301de774c21d055e9e5a7073e5bffdb52bc71079.
2017-01-20Refs #23919 -- Removed unneeded str() callsClaude Paroz
2017-01-18Refs #23919 -- Removed python_2_unicode_compatible decorator usageClaude Paroz
2017-01-18Refs #23919 -- Removed encoding preambles and future importsClaude Paroz
2016-10-04Refs #27118 -- Reallowed using pk in QuerySet.get/update_or_create().François Freitag
2016-09-27Fixed #27271 -- Fixed a crash in runserver logging.Sergey Fursov
Allowed ServerFormatter to handle simple string messages or messages with formatting arguments. The formatter will set the server_time variable on the log record if it's required by the format string but wasn't passed in extra parameters.
2016-09-24Fixed #27118 -- Made QuerySet.get_or_create()/update_or_create() error for a ↵François Freitag
non-field in their arguments.
2016-07-28Fixed #26933 -- Fixed flaky update_or_create() test from refs #26804.Jensen Cochran
2016-07-14Fixed #26804 -- Fixed a race condition in QuerySet.update_or_create().Jensen Cochran
2016-07-12Fixed #26884 -- Evaluated callables in QuerySet.update_or_create()'s ↵Kenneth
defaults when updating.
2016-06-28Replaced use of TestCase.fail() with assertRaises().Tim Graham
Also removed try/except/fail antipattern that hides exceptions.
2016-06-03Fixed #26638 -- Allowed callable arguments for ↵Will Koster
QuerySet.get_or_create()/update_or_create() defaults.
2016-01-29Refs #26022 -- Used context manager version of assertRaises in tests.Hasan
2015-07-27Fixed #21127 -- Started deprecation toward requiring on_delete for ↵Flavio Curella
ForeignKey/OneToOneField
2015-06-05Refs #22728 - Added missing tests for defaults__exact caseAndriy Sokolovskiy
2015-02-06Sorted imports with isort; refs #23860.Tim Graham
2014-12-30Applied ignore_warnings to Django testsClaude Paroz
2014-10-08Fixed misplaced test case.Loic Bistuer
2014-10-08Fixed #23611 -- update_or_create failing from a related managerLoic Bistuer
Added update_or_create to RelatedManager, ManyRelatedManager and GenericRelatedObjectManager. Added missing get_or_create to GenericRelatedObjectManager.
2014-04-21Consolidated get_or_create tests.Aymeric Augustin
2014-04-16Fixed flake8 warnings introduced in recent commits.Simon Charette
2014-04-14Refs #18586 - Refactored model get_or_create test.Liav Koren
Refactored get_or_create test into several smaller test functions across two different test classes. Also converted the comments over to docstrings.
2013-12-10Fixed E124 pep8 warnings.Loic Bistuer
2013-10-19Removed unused local variables in tests.Tim Graham
2013-09-22Translated a test to English for consistency.Aymeric Augustin
Also fixed a typo.
2013-07-29Removed most of absolute_import importsClaude Paroz
Should be unneeded with Python 2.7 and up. Added some unicode_literals along the way.
2013-07-12Fixed #20429 -- Added QuerySet.update_or_createKarol Sikora
Thanks tunixman for the suggestion and Loic Bistuer for the review.
2013-06-10Defined available_apps in relevant tests.Aymeric Augustin
Fixed #20483.
2013-05-27Fixed #16137 - Removed kwargs requirement for QuerySet.get_or_createTim Graham
Thanks wilfred@, poirier, and charettes for work on the patch.
2013-05-26Fixed get_or_create...test_savepoint_rollback test for Python3Shai Berger
The test was always skipped on Python3 because string literals are unicode
2013-05-26Fix get_or_create test failure under OracleShai Berger
Test expected that when given invalid utf-8, the backend should raise a DatabaseError, but the Oracle backend raises a UnicodeDecodeError.
2013-05-22Fixed #20463 -- Made get_or_create more robust.Aymeric Augustin
When an exception other than IntegrityError was raised, get_or_create could fail and leave the database connection in an unusable state. Thanks UloPe for the report.
2013-05-19Lower the max length for a test field so that it works on MySQL.Alex Gaynor