1
0
mirror of https://github.com/django/django.git synced 2025-04-07 15:06:47 +00:00

13848 Commits

Author SHA1 Message Date
Clifford Gama
d5c19f9b32 Fixed #34819 -- Made GenericForeignKey prefetching use matching pk representations.
Ensured that rel_obj_attr and instance_attr return matching (pk, cls) tuples
in GenericForeignKey.get_prefetch_queryset(), preventing mismatches when
prefetching related objects where pk and get_prep_value() differ. Using
value_to_string() also makes this code compatible with composite primary keys.
2025-03-26 09:55:38 +01:00
Dmitry Shachnev
77b4ecbd53 Fixed #36260 -- Made bulk_create() work with DB-generated primary keys.
Co-authored-by: Simon Charette <charette.s@gmail.com>
2025-03-26 09:55:09 +01:00
Giannis Terzopoulos
a39c28706a Fixed #35529 -- Added support for positional arguments in querystring template tag.
Co-authored-by: Natalia <124304+nessita@users.noreply.github.com>
2025-03-25 12:23:41 -03:00
Jason Cameron
9608678704 Fixed #36262 -- Made GeneratedField.db_persist a required key-word argument. 2025-03-25 12:50:24 +01:00
wookkl
334677ad57 Fixed #35452 -- Deprecated orphans being more than or equal to page_size in pagination. 2025-03-25 12:04:13 +01:00
Tim Graham
fecca298a2 Fixed #36276 -- Omitted size=None from ArrayField.deconstruct(). 2025-03-25 12:02:14 +01:00
YogyaChugh
7164f08047 Fixed #36271 -- Raised TemplateSyntaxError when using a relative template path with an unknown origin. 2025-03-24 17:05:58 +01:00
Natalia
0b4f2d8d39 Fixed #36268 -- Added leading ? in every querystring template tag result.
Thanks Sarah Boyce for the report.
2025-03-24 11:53:42 -03:00
Natalia
639eafbd27 Ensured consistency in naming in template_tests/syntax_tests/test_querystring.py. 2025-03-24 11:53:42 -03:00
Johanan Oppong Amoateng
5adadf6e8c Fixed #36266 -- Renamed HIDE_PRODUCTION_WARNING environment variable to DJANGO_RUNSERVER_HIDE_WARNING. 2025-03-21 10:19:36 +01:00
Mike Edmunds
e295033144 Fixed #36138 -- Changed ADMINS and MANAGERS settings to lists of strings.
Previously, the ADMINS and MANAGERS settings were lists of (name, address)
tuples (where the name had been unused). Deprecated use of tuples.

Updated settings value sanity checks, and changed from ValueError to
ImproperlyConfigured.
2025-03-21 10:17:57 +01:00
Ahmed Nassar
ec7044c706 Fixed #36000 -- Deprecated HTTP as the default protocol in urlize and urlizetrunc. 2025-03-19 14:28:42 +01:00
Sarah Boyce
8f400a7ff0 Made selenium tests less flaky by waiting until popups are closed and page is loaded. 2025-03-18 10:52:01 +01:00
Mike Edmunds
62ad970c39 Refs #36138 -- Improved tests for mail_admins() and mail_managers().
- Separated MailTests.test_connection_arg test cases.
- Expanded test cases for incorrect values of ADMINS/MANAGERS settings.
- Added test case verifying correct values of ADMINS/MANAGERS settings.
2025-03-18 10:08:09 +01:00
fowczrek
6a9db1e626 Fixed #34865 -- Released memory earlier than garbage collection on database wrapping layers.
Thank you Florian Apolloner, Jake Howard and Patryk Zawadzki for
the clarifying comments and reviews.
2025-03-17 18:28:20 -03:00
hesham942
e804a07d76 Fixed #36252 -- Handled duplicate automatic imports in the shell command. 2025-03-17 16:29:28 -03:00
Mariusz Felisiak
1823a80113 Fixed #33537 -- Made test database cloning on MySQL reraise unexpected errors.
Thanks Faakhir Zahid and Stephen Finucane for the initial patch.

Thanks Simon Charette for the review.
2025-03-17 15:45:08 +01:00
Mariusz Felisiak
e7a9d756ee
Refs #35945 -- Fixed test_paginating_unordered_queryset_raises_warning_async() test on byte-compiled Django. 2025-03-13 11:06:44 +01:00
Adam Johnson
27b68bcadf Fixed #36234 -- Restored single_object argument to LogEntry.objects.log_actions().
Thank you Adam Johnson for the report and fix. Thank you Sarah Boyce for
your spot on analysis.

Regression in c09bceef68e5abb79accedd12dade16aa6577a09, which is
partially reverted in this branch.

Co-authored-by: Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
2025-03-12 16:25:28 -03:00
wookkl
2ae3044d9d Fixed #35945 -- Added async interface to Paginator. 2025-03-12 09:22:44 +01:00
Clifford Gama
0ebea6e5c0 Fixed #35676 -- Made BaseModelForm validate constraints that reference an InlineForeignKeyField.
Co-authored-by: Simon Charette <charette.s@gmail.com>
2025-03-12 09:16:15 +01:00
haileyajohnson
5183f7c287
Fixed #35816 -- Handled parsing of scientific notation in DTL. (#19213)
* Refs #35816 -- Improved test coverage of FilterExpression.

* Fixed #35816 -- Made FilterExpression parse scientific numbers.

---------

Co-authored-by: Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
2025-03-11 08:02:27 +01:00
Tom Carrick
8df5ce80d2
Fixed #36177 -- Added a trailing newline to JSON serializer. (#19232) 2025-03-11 08:01:06 +01:00
Simon Charette
ab148c02ce Fixed #33579 -- Specialized exception raised on forced update failures.
Raising DatabaseError directly made it harder than it should to
differentiate between IntegrityError when a forced update resulted in no
affected rows.

Introducing a specialized exception allows for callers to more easily
silence, log, or turn them update failures into user facing exceptions
(e.g. 404s).

Thanks Mariusz for the review.
2025-03-10 21:09:15 +01:00
saJaeHyukc
c1257350ca Fixed #36222 -- Fixed ExclusionConstraint validation crash on excluded fields in condition.
Signed-off-by: saJaeHyukc <wogur981208@gmail.com>
2025-03-10 20:11:01 +01:00
saJaeHyukc
f480d5d3ed Fixed #36201 -- Caught ValidationError in ModelChoiceField/ModelMultipleChoiceField.clean().
Signed-off-by: saJaeHyukc <wogur981208@gmail.com>
2025-03-10 13:01:02 +01:00
petr.prikryl
2a5aca38bb Fixed #35487 -- Removed CASCADE from RemoveField() on PostgreSQL.
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
Co-authored-by: Adam Johnson <me@adamj.eu>
Co-authored-by: Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
2025-03-09 11:50:17 +01:00
Sarah Boyce
de1117ea8e Fixed #36224 -- Fixed shell imports when settings not configured.
Thank you Raffaella for the report. Thank you Tim Schilling and Natalia Bidart
for the reviews.
2025-03-07 15:34:56 +01:00
Sarah Boyce
647dca4132 Corrected test case in ExclusionConstraintTests.test_invalid_expressions(). 2025-03-07 11:28:00 +01:00
Sarah Boyce
55d89e25f4 Fixed CVE-2025-26699 -- Mitigated potential DoS in wordwrap template filter.
Thanks sw0rd1ight for the report.
2025-03-06 09:38:40 +01:00
antoliny0919
c09bceef68 Fixed #36217 -- Restored pre_save/post_save signal emission via LogEntry.save() for single-object deletion in the admin.
Regression in 40b3975e7d3e1464a733c69171ad7d38f8814280.

Thanks smiling-watermelon for the report.

Co-authored-by: Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
2025-03-04 10:34:15 +01:00
Chris Muthig
4b977a5d72 Fixed #35444 -- Added generic support for Aggregate.order_by.
This moves the behaviors of `order_by` used in Postgres aggregates into
the `Aggregate` class. This allows for creating aggregate functions that
support this behavior across all database engines. This is shown by
moving the `StringAgg` class into the shared `aggregates` module and
adding support for all databases. The Postgres `StringAgg` class is now
a thin wrapper on the new shared `StringAgg` class.

Thank you Simon Charette for the review.
2025-03-03 11:37:00 +01:00
Simon Charette
fc30355107 Fixed #36198 -- Implemented unresolved transform expression replacement.
This allows the proper resolving of F("field__transform") when
performing constraint validation.

Thanks Tom Hall for the report and Sarah for the test.
2025-03-01 19:57:53 +01:00
Mariusz Felisiak
ff3aaf036f
Applied Black's 2025 stable style.
https://github.com/psf/black/releases/tag/25.1.0
2025-03-01 19:41:37 +01:00
Jacob Walls
77666f2fa1 Refs #35617 -- Removed hardcoded pk in test_bulk_update_custom_get_prep_value(). 2025-02-27 09:42:08 +01:00
Clifford Gama
5a1cae3a56 Removed outdated docstring in tests/basic/models.py. 2025-02-25 15:22:08 +01:00
Jonathan Ströbele
240421c7c4 Fixed #36186 -- Added forloop.length variable within a template for loop. 2025-02-24 16:25:53 +01:00
enprava
51cab4ad51 Fixed #35705 -- Added Rotate GIS database function to rotate geometries. 2025-02-23 16:20:57 +01:00
saJaeHyukc
f7017db92c Fixed #35839 -- Fixed crash when adding GeneratedField with db_comment on MySQL.
Thanks Simon Charette for the test.

Signed-off-by: saJaeHyukc <wogur981208@gmail.com>
2025-02-22 18:14:37 +01:00
Mariusz Felisiak
7500044a82 Refs #35167 -- Fixed test_bulk_update_custom_get_prep_value() crash on databases that don't support primitives in JSONFields.
For example on Oracle < 21c.
2025-02-20 08:14:18 +01:00
Jacob Walls
0bf412111b Fixed #35167 -- Delegated to super() in JSONField.get_db_prep_save().
Avoids reports of bulk_update() sending Cast expressions
to JSONField.get_prep_value().

Co-authored-by: Simon Charette <charette.s@gmail.com>
2025-02-18 17:28:24 +01:00
Simon Charette
c3a23aa02f Fixed #36197 -- Fixed improper many-to-many count() and exists() for non-pk to_field.
Regression in 66e47ac69a7e71cf32eee312d05668d8f1ba24bb.

Thanks mfontana-elem for the report and Sarah for the tests.
2025-02-18 11:43:27 +01:00
mimi89999
727731d76d Fixed #36179 -- Unhexed entries and removed duplicates in auth/common-passwords.txt.gz. 2025-02-18 08:58:49 +01:00
Mariusz Felisiak
efb7f9ced2
Refs #36005 -- Used datetime.UTC alias instead of datetime.timezone.utc.
datetime.UTC was added in Python 3.11.
2025-02-18 08:35:36 +01:00
Gaël Utard
0d1dd6bba0 Fixed #36191 -- Truncated the overwritten file content in FileSystemStorage. 2025-02-17 14:01:00 +01:00
Simon Charette
2d34ebe49a Refs #35967 -- Deprecated BaseDatabaseCreation.create_test_db(serialize).
Given there are no longer any internal usages of serialize=True and it
poses a risk to non-test databases integrity it seems appropriate to
deprecate it.
2025-02-16 08:43:42 +01:00
Simon Charette
dc69a63f84 Fixed #35967 -- Deferred test suite fixtures serialization after all dbs setup.
While the top-level objects fed to serialization are bound to the test
database being created nothing prevents code invoked during
serialization from performing queries against other connections entries
that haven't been swapped yet.

The reported example of that is a database router directing all reads to
a test mirror for a set of models involving auto-created many-to-many
fields. It might be tempting to address the many-to-many field case but
this a symptom of a larger problem where the test framework yields the
flow execution to user code that could interact with non-test databases
in unexpected ways.

Deferring test database fixture serialization until the point where all
connections entries have been swapped for their test equivalent ensures
that no code triggered during serialization can interact with non-test
databases.

Thanks Jake Howard for the report and Jacob Walls for the initial
investigation.
2025-02-16 07:58:15 +01:00
Simon Charette
df2c4952df Fixed #36173 -- Stabilized identity of Concat with an explicit output_field.
When Expression.__init__() overrides make use of *args, **kwargs
captures their argument values are respectively bound as a tuple and
dict instances. These composite values might themselves contain values
that require special identity treatments such as Concat(output_field)
as it's a Field instance.

Refs #30628 which introduced bound Field differentiation but lacked
argument captures handling.

Thanks erchenstein for the report.
2025-02-15 15:46:59 +01:00
Natalia
56e23b2319 Fixed #36158 -- Refactored shell command to improve auto-imported objects reporting. 2025-02-13 16:01:13 +01:00
Sarah Boyce
05002c153c Fixed #36182 -- Returned "?" if all parameters are removed in querystring template tag.
Thank you to David Feeley for the report and Natalia Bidart for the review.
2025-02-13 15:49:25 +01:00