1
0
mirror of https://github.com/django/django.git synced 2024-12-22 17:16:24 +00:00
Commit Graph

302 Commits

Author SHA1 Message Date
Sarah Boyce
ae1ee24178 Fixed #35766 -- Handled slices in BaseChoiceIterator. 2024-09-18 16:45:53 +02:00
Simon Charette
39abd56a7f Refs #35405 -- Adjusted deprecation warning stacklevel in FieldCacheMixin.get_cache_name(). 2024-08-28 11:44:05 -03:00
Hisham Mahmood
519087819e
Fixed #35695 -- Ensured FileFields use a storage pointing to a temp directory in model_fields tests. 2024-08-21 08:51:25 -03:00
Mariusz Felisiak
2d3bb414cf Refs #35560 -- Corrected required feature flags in GeneratedModelUniqueConstraint. 2024-07-15 10:20:09 +02:00
Mark Gensler
1005c2abd1 Fixed #35560 -- Made Model.full_clean() ignore GeneratedFields for constraints.
Accessing generated field values on unsaved models caused a crash when
validating CheckConstraints and UniqueConstraints with expressions.
2024-07-04 11:45:15 +02:00
Sarah Boyce
7e39ae5c8c Fixed #35472 -- Used temporary directory in test_imagefield.NoReadTests. 2024-05-22 16:37:23 -03:00
John Parton
9c5fe93349 Fixed #35139 -- Prevented file read after ImageField is saved to storage. 2024-05-22 00:25:56 +02:00
Adam Johnson
b9838c65ec Fixed #35405 -- Converted get_cache_name into a cached property in FieldCacheMixin.
FieldCacheMixin is used by related fields to track their cached values.
This work migrates get_cache_name() to be a cached property to optimize
performance by reducing unnecessary function calls when working with
related fields, given that its value remains constant.

Co-authored-by: Simon Charette <charette.s@gmail.com>
Co-authored-by: Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
Co-authored-by: Natalia <124304+nessita@users.noreply.github.com>
2024-05-21 16:19:29 -03:00
Jonny Park
c0b0ce85ed Fixed #35384 -- Raised FieldError when saving a file without a name to FileField. 2024-05-15 12:02:45 +02:00
Sarah Boyce
8b53560eea Fixed #35350 -- Fixed save() with pk set on models with GeneratedFields.
Thanks Matt Hegarty for the report and Simon Charette and Natalia Bidart for the reviews.

Regression in f333e35.
2024-04-10 15:43:50 +02:00
Johannes Westphal
5f18021640 Fixed #35344, Refs #34838 -- Corrected output_field of resolved columns for GeneratedFields in aliased tables.
Thanks Simon Charette for the review.
2024-04-01 18:54:38 +01:00
Simon Charette
0d8fbe2ade Refs #34060 -- Fixed crash when filtering against literal JSON with psycopg2. 2024-02-16 07:40:33 +01:00
Mariusz Felisiak
4879907223
Fixed #35127 -- Made Model.full_clean() ignore GeneratedFields.
Thanks Claude Paroz for the report.

Regression in f333e3513e.
2024-01-19 08:55:50 +01:00
Mariusz Felisiak
d88ec42bd0
Used addCleanup() in tests where appropriate. 2023-12-31 10:01:31 +01:00
Sarah Boyce
b287af5dc9 Fixed #35019 -- Fixed save() on models with both GeneratedFields and ForeignKeys.
Thanks Deb Kumar Das for the report.

Regression in f333e3513e.
2023-12-08 09:46:11 +01:00
Mariusz Felisiak
5b3b791e90
Fixed #35024 -- Fixed model instance creation crash on GeneratedField.output_field with backend converters.
Regression in d9de74141e.

This is a long standing issue, however it caused a crash of
GeneratedFields for all output fields that have backend-specific
converters when the RETURNING clause is not supported
(MySQL and SQLite < 3.35).
That's why severity was exacerbated.
2023-12-07 20:50:18 +01:00
Mariusz Felisiak
101a85a5a0
Fixed #34985 -- Fixed GeneratedFields.contribute_to_class() crash when apps are not populated.
Thanks Paolo Melchiorre for the report.

Regression in f333e3513e.
2023-11-22 13:41:32 +01:00
Mariusz Felisiak
5875f03ce6 Fixed #34944 -- Made GeneratedField.output_field required.
Regression in f333e3513e.
2023-11-14 20:22:07 +01:00
Tim Graham
208870b612 Refs #31300 -- Allowed testing GeneratedField without collation.
CockroachDB and Snowflake don't support it.
2023-11-02 13:58:46 +01:00
Paolo Melchiorre
e7e8eb44a3 Fixed #34877 -- Fixed migrations crash when adding GeneratedField with output_field with params. 2023-09-28 05:50:42 +02:00
Tim Graham
b0788a0918
Fixed JSONField's test_deep_distinct for DatabaseFeatures.nulls_order_largest=False.
Failure observed on CockroachDB.
2023-09-22 06:25:17 +02:00
Mariusz Felisiak
8af3ae4ad9
Isolated test models for GeneratedFields.
Test regression in f333e3513e.
2023-09-19 08:09:03 +02:00
Mariusz Felisiak
5e4c1793b7 Refs #33308 -- Removed support for passing encoded JSON string literals to JSONField & co.
Per deprecation timeline.
2023-09-18 22:12:40 +02:00
Paolo Melchiorre
2f1ab16be5 Fixed #34842 -- Fixed ModelAdmin.readonly_fields crash with GeneratedFields. 2023-09-16 20:13:02 +02:00
Paolo Melchiorre
68d769e691 Fixed #34838 -- Corrected output_field of resolved columns for GeneratedFields.
Thanks Simon Charette for the implementation idea.
2023-09-14 21:17:12 +02:00
Natalia
691f70c477 Fixed #24561 -- Added support for callables on model fields' choices. 2023-09-14 10:15:33 -03:00
Jeremy Nauta
f333e3513e Fixed #31300 -- Added GeneratedField model field.
Thanks Adam Johnson and Paolo Melchiorre for reviews.

Co-Authored-By: Lily Foote <code@lilyf.org>
Co-Authored-By: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2023-09-07 06:19:08 +02:00
Nick Pope
500e01073a
Fixed #31262 -- Added support for mappings on model fields and ChoiceField's choices. 2023-08-30 22:57:40 -03:00
Natalia
f1c0a3baf7 Added tests for model field's choices iterator/iterable values. 2023-08-22 05:55:23 +02:00
François Freitag
bcacc6321a Refs #34517 -- Restored skipping ImageFileField.update_dimension_fields without width/height fields.
This avoids reading the image size when the dimensions fields
(image_width, image_height) do not exist, as that operation may be
expensive.

Partially reverts ea53e7c09f, that dropped
the check for the dimension fields in update_dimension_fields(), because
the post_init signal was no longer registered without dimension fields.

However, another code path to that function exists: when the
ImageFileField is save()d, the name from the storage is setattr()ed on
the field, and ImageFileDescriptor calls update_dimension_fields()
because the image size might have changed. Keep bailing out early when
dimensions are unused.

Besides, computing the image dimensions causes to close() the file,
resulting in a backward-incompatible change. The test protects against
that change.
2023-06-19 05:24:42 +02:00
David Sanders
0c1518ee42
Fixed #34590 -- Reverted "Refs #33308 -- Improved adapting DecimalField values to decimal."
This reverts 7990d254b0.

Thanks Marc Odermatt for the report.
2023-05-24 10:59:55 +02:00
Julie Rymer
0ec60661e6 Fixed #34539 -- Restored get_prep_value() call when adapting JSONFields.
Regression in 5c23d9f0c3.
2023-05-16 08:26:41 +02:00
Orhan Hirsch
ea53e7c09f Fixed #34517 -- Avoided connection post_init signal to ImageField without width/height fields. 2023-05-03 06:35:19 +02:00
T. Franzel
a2eaea8f22 Fixed #34388 -- Allowed using choice enumeration types directly on model and form fields. 2023-03-21 19:44:41 +01:00
Simon Charette
dde2537fbb Fixed #27397 -- Prevented integer overflows on integer field lookups.
This prevents a sqlite3 crash and address a potential DDoS vector on
PostgreSQL caused by full-table-scans on overflows.
2023-03-09 15:55:10 +01:00
David Smith
097e3a70c1 Refs #33476 -- Applied Black's 2023 stable style.
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
2023-02-01 11:04:38 +01:00
Francesco Panico
c179ad9fe7 Refs #34100 -- Made file upload tests use Storage.exists() where appropriate. 2022-12-30 13:28:47 +01:00
Daniele Varrazzo
09ffc5c121 Fixed #33308 -- Added support for psycopg version 3.
Thanks Simon Charette, Tim Graham, and Adam Johnson for reviews.

Co-authored-by: Florian Apolloner <florian@apolloner.eu>
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2022-12-15 06:17:57 +01:00
Simon Charette
0ff46591ac Refs #33308 -- Deprecated support for passing encoded JSON string literals to JSONField & co.
JSON should be provided as literal Python objects an not in their
encoded string literal forms.
2022-12-01 19:14:00 +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
Allen Jonathan David
10178197d5 Fixed #33966 -- Added support for using KeyTextTransform from lookup. 2022-09-16 05:36:57 +02:00
Mohamed Karam
b92ffebb0c Fixed #33954 -- Prevented models.DecimalField from accepting NaN, Inf, and -Inf values. 2022-08-27 15:51:08 +02:00
Claude Paroz
4488a25cc9 Removed unused path variable in model_fields tests. 2022-08-23 15:34:07 +02:00
Mariusz Felisiak
e9fd2b5724
Refs #26511 -- Fixed json.KeyTextTransform() on MySQL/MariaDB. 2022-08-18 21:02:29 +02:00
Mariusz Felisiak
aaf00450d2
Removed obsolete assertions in BooleanFieldTests.test_return_type().
Added in e9bbdb39de.
Obsolete since e9103402c0.
2022-06-03 21:28:46 +02:00
Collin Anderson
0de89b6f8d
Refs #31223 -- Added __class_getitem__() to ForeignKey. 2022-04-22 14:13:12 +02:00
Mariusz Felisiak
1760ad4e8c
Relaxed some query ordering assertions in various tests.
It accounts for differences seen on MySQL with MyISAM storage engine.
2022-04-14 12:12:13 +02:00
Himanshu-Balasamanta
06ebaa9e28 Fixed #33626 -- Cleared cache when unregistering a lookup. 2022-04-12 06:24:02 +02:00
Sage Abdullah
a88fab1bca Fixed #33552 -- Fixed JSONField has key lookups with numeric keys on MariaDB, MySQL, Oracle, and SQLite. 2022-03-15 06:37:35 +01:00
Nick Pope
847f46e9bf
Removed redundant QuerySet.all() calls in docs and tests.
Most QuerySet methods are mapped onto the Manager and, in general,
it isn't necessary to call .all() on the manager.
2022-02-22 10:29:38 +01:00