Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/intro/reusable-apps.txt
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ this. For a small app like polls, this process isn't too difficult.
:caption: ``django-polls/pyproject.toml``

[build-system]
requires = ["setuptools>=69.3"]
requires = ["setuptools>=77.0.3"]
build-backend = "setuptools.build_meta"

[project]
Expand All @@ -219,6 +219,7 @@ this. For a small app like polls, this process isn't too difficult.
]
description = "A Django app to conduct web-based polls."
readme = "README.rst"
license = "BSD-3-Clause"
requires-python = ">= 3.12"
authors = [
{name = "Your Name", email = "yourname@example.com"},
Expand All @@ -228,7 +229,6 @@ this. For a small app like polls, this process isn't too difficult.
"Framework :: Django",
"Framework :: Django :: X.Y", # Replace "X.Y" as appropriate
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
Expand Down
15 changes: 15 additions & 0 deletions docs/ref/models/querysets.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2506,6 +2506,21 @@ them, but it has a few caveats:
* If updating a large number of columns in a large number of rows, the SQL
generated can be very large. Avoid this by specifying a suitable
``batch_size``.
* When updating a large number of objects, be aware that ``bulk_update()``
prepares all of the ``WHEN`` clauses for every object across all batches
before executing any queries. This can require more memory than expected. To
reduce memory usage, you can use an approach like this::

from itertools import islice

batch_size = 100
ids_iter = range(1000)
while ids := list(islice(ids_iter, batch_size)):
batch = Entry.objects.filter(ids__in=ids)
for entry in batch:
entry.headline = f"Updated headline {entry.pk}"
Entry.objects.bulk_update(batch, ["headline"], batch_size=batch_size)

* Updating fields defined on multi-table inheritance ancestors will incur an
extra query per ancestor.
* When an individual batch contains duplicates, only the first instance in that
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["setuptools>=75.8.1"]
requires = ["setuptools>=77.0.3"]
build-backend = "setuptools.build_meta"

[project]
Expand All @@ -16,13 +16,13 @@ authors = [
]
description = "A high-level Python web framework that encourages rapid development and clean, pragmatic design."
readme = "README.rst"
license = {text = "BSD-3-Clause"}
license = "BSD-3-Clause"
license-files = ["LICENSE", "LICENSE.python"]
classifiers = [
"Development Status :: 2 - Pre-Alpha",
"Environment :: Web Environment",
"Framework :: Django",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
Expand Down