thank you. i take note
Sorry @sarahboyce @felixxm if I gave the impression of necessarily wanting another opinion. it’s just that I generally can’t move forward when things aren’t clear in my head.
Between us novices and you veterans, words don’t necessarily have the same definition, so we can understand things differently.
In case this is not clear. I think you are confused by me saying this:
- “introduced in Django 5.1” is not required as this is in the versionchanged notes
What I am saying is keep versionchanged (as Mariusz suggested) but in the docs you say “introduced in Django 5.1” a few times e.g.:
The
condition
parameter, introduced in Django 5.1, allows specifying a…
You do not need to say “introduced in Django 5.1” and can remove these.
Explanation
When we are on version 7.2 no one will care that this was introduced in 5.1.
“versionadded” and “versionchanged” is the way we communicate changes and generally not inside the definitions.
Lastly, avoid using @ to get people’s attention.
So right now, say “Mariusz”, not “@fel…” and Sarah not “@sar…”
There are a lot of people contributing to Django at every moment. For those who are doing reviews and looking at tickets, imagine doing “@fe…” is like shouting. It’s ok for someone to shout if they have been forgotten about (forgotten means it’s been a month with no response), but if you have people talking to you within a month, then there’s no need to shout. We will reply, it takes time.
Does that make sense?
ok I take note Sarah . thank you
hello everyone. a little help please. at the last commit everything was working. after working only on the documentation, the asynchronous test added to my last commit failed. but all the synchronous tests passed. Maybe I missed something?
(.djangodev) barhamou@barhamou-hplaptop15sfq5xxx:~/mes-projets/contribution_a_django/django/tests$ ./runtests.py bulk_create
Testing against Django installed in '/home/barhamou/mes-projets/contribution_a_django/django/django' with up to 12 processes
Found 59 test(s).
Creating test database for alias 'default'...
System check identified no issues (0 silenced).
............s....s.......................s...s...s......sss
----------------------------------------------------------------------
Ran 59 tests in 0.241s
OK (skipped=8)
Destroying test database for alias 'default'...
(.djangodev) barhamou@barhamou-hplaptop15sfq5xxx:~/mes-projets/contribution_a_django/django/tests$
(.djangodev) barhamou@barhamou-hplaptop15sfq5xxx:~/mes-projets/contribution_a_django/django/tests$ ./runtests.py async
Testing against Django installed in '/home/barhamou/mes-projets/contribution_a_django/django/django' with up to 12 processes
Found 65 test(s).
Creating test database for alias 'default'...
Cloning test database for alias 'default'...
Cloning test database for alias 'default'...
Cloning test database for alias 'default'...
Cloning test database for alias 'default'...
Cloning test database for alias 'default'...
Cloning test database for alias 'default'...
Cloning test database for alias 'default'...
Cloning test database for alias 'default'...
Cloning test database for alias 'default'...
System check identified no issues (0 silenced).
.........................................E......................s
======================================================================
ERROR: test_abulk_create_with_complex_excluded_expression (async.test_async_queryset.AsyncQuerySetTest.test_abulk_create_with_complex_excluded_expression)
Utility class which turns an awaitable that only works on the thread with
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/lib/python3.11/unittest/case.py", line 57, in testPartExecutor
yield
File "/usr/lib/python3.11/unittest/case.py", line 623, in run
self._callTestMethod(testMethod)
^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/unittest/case.py", line 579, in _callTestMethod
if method() is not None:
^^^^^^^^^^^^^^^^^
File "/home/barhamou/mes-projets/contribution_a_django/django/django/test/testcases.py", line 1485, in skip_wrapper
return test_func(*args, **kwargs)
^^^^^^^^^^^^^^^^^
File "/home/barhamou/mes-projets/contribution_a_django/django/django/test/testcases.py", line 1485, in skip_wrapper
return test_func(*args, **kwargs)
^^^^^^^^^^^^^^^^^
File "/home/barhamou/mes-projets/contribution_a_django/.djangodev/lib/python3.11/site-packages/asgiref/sync.py", line 277, in __call__
return call_result.result()
^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/concurrent/futures/_base.py", line 449, in result
return self.__get_result()
^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result
raise self._exception
^^^^^^^^^^^^^^^^^
File "/home/barhamou/mes-projets/contribution_a_django/.djangodev/lib/python3.11/site-packages/asgiref/sync.py", line 353, in main_wrap
result = await self.awaitable(*args, **kwargs)
^^^^^^^^^^^^^^^^^
File "/home/barhamou/mes-projets/contribution_a_django/django/tests/async/test_async_queryset.py", line 140, in test_abulk_create_with_complex_excluded_expression
await UpsertConflict.objects.abulk_create(
^^^^^^^^^^^^^^^^^
File "/home/barhamou/mes-projets/contribution_a_django/django/django/db/models/manager.py", line 87, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
^^^^^^^^^^^^^^^^^
TypeError: QuerySet.abulk_create() got an unexpected keyword argument 'condition'
----------------------------------------------------------------------
Ran 65 tests in 0.118s
FAILED (errors=1, skipped=1)
Destroying test database for alias 'default'...
Destroying test database for alias 'default'...
Destroying test database for alias 'default'...
Destroying test database for alias 'default'...
Destroying test database for alias 'default'...
Destroying test database for alias 'default'...
Destroying test database for alias 'default'...
Destroying test database for alias 'default'...
Destroying test database for alias 'default'...
Destroying test database for alias 'default'...
(.djangodev) barhamou@barhamou-hplaptop15sfq5xxx:~/mes-projets/contribution_a_django/django/tests$
here’s my test add
@skipUnlessDBFeature("has_bulk_insert")
@skipUnlessDBFeature("supports_update_conflicts_with_condition")
@async_to_sync
async def test_abulk_create_with_complex_excluded_expression(self):
initial_items = [
UpsertConflict(number=1, rank=3, name="John"),
UpsertConflict(number=2, rank=5, name="Mary"),
UpsertConflict(number=3, rank=4, name="EmmaAlice"),
]
await UpsertConflict.objects.abulk_create(initial_items)
updated_items = [
UpsertConflict(number=1, rank=5, name="Steve"),
UpsertConflict(number=2, rank=4, name="Olivia"),
UpsertConflict(number=3, rank=6, name="Emma"),
]
await UpsertConflict.objects.abulk_create(
updated_items,
update_conflicts=True,
update_fields=["name", "rank"],
unique_fields=["number"],
condition=(
Q(rank__gt=F("number") + 1) & Q(rank__lt=Excluded("rank"))
| Q(name__startswith=Excluded("name"))
),
)
self.assertEqual((await UpsertConflict.objects.aget(number=1)).name, "Steve")
self.assertEqual((await UpsertConflict.objects.aget(number=2)).name, "Mary")
self.assertEqual((await UpsertConflict.objects.aget(number=3)).name, "Emma")