| Age | Commit message (Collapse) | Author |
|
Regression in 94680437a45a71c70ca8bd2e68b72aa1e2eff337. Refs #27222.
During INSERT operations, `field.pre_save()` is called to prepare values
for db insertion. The `add` param must be `True` for `auto_now_add`
fields to be populated. The regression commit passed `False`, causing
`auto_now_add` fields to remain `None` when used by other fields, such
as `upload_to` callables.
Thanks Ran Benita for the report.
|
|
|
|
Proxy models subclassing a model with a CompositePrimaryKey were
incorrectly reporting check errors because the check that requires only
local fields to be used in a composite pk was evaluated against the proxy
subclass, which has no fields.
To fix this, composite pk field checks are not evaluated against
proxy subclasses, as none of the checks are applicable to proxy
subclasses. This also has the benefit of not double-reporting real check
errors from an invalid superclass pk.
Thanks Clifford Gama for the review.
|
|
Thanks Simon Charette for pair programming.
Co-authored-by: Nick Stefan <NickStefan12@gmail.com>
Co-authored-by: Akash Kumar Sen <71623442+Akash-Kumar-Sen@users.noreply.github.com>
Co-authored-by: Simon Charette <charette.s@gmail.com>
|
|
May your database queries be much reduced with minimal effort.
co-authored-by: Andreas Pelme <andreas@pelme.se>
co-authored-by: Simon Charette <charette.s@gmail.com>
co-authored-by: Jacob Walls <jacobtylerwalls@gmail.com>
|
|
|
|
ForeignObject in Meta.indexes/constraints/unique_together.
ForeignObjects with multiple `from_fields` are not supported in these
options.
Co-authored-by: Jacob Walls <jacobtylerwalls@gmail.com>
Co-authored-by: Natalia <124304+nessita@users.noreply.github.com>
|
|
even if a value is set.
The logic could likely be adjusted to assign the pre_save value in most cases
to avoid the database transit but it could break in subtle ways so it's not
worth the complexity it would require.
Regression in 94680437a45a71c70ca8bd2e68b72aa1e2eff337.
Co-authored-by: Tim Graham <timograham@gmail.com>
|
|
Follow-up to 94680437a45a71c70ca8bd2e68b72aa1e2eff337.
|
|
ForeignObject.
Follow-up to e44e8327d3d88d86895735c0e427102063ff5b55. Refs #36222.
|
|
Removed the can_return_columns_from_insert skip gates on existing
field_defaults tests to confirm the expected number of queries are
performed and that returning field overrides are respected.
|
|
This required implementing UPDATE RETURNING machinery that heavily
borrows from the INSERT one.
|
|
|
|
Rewrapped long docstrings and block comments to 79 characters + newline
using script from https://github.com/medmunds/autofix-w505.
|
|
ForeignKey attname.
Regression in e44e8327d3d88d86895735c0e427102063ff5b55.
Thank you to Jacob Walls for the report.
Co-authored-by: Simon Charette <charette.s@gmail.com>
|
|
Previously save() would crash with an attempted forced update message, and both
save(force_insert=True) and bulk_create() would crash with DoesNotExist errors
trying to retrieve rows with an empty primary key (id IS NULL).
Implementing deferred field model instance copying might be doable in certain
cases (e.g. when all the deferred fields are db generated) but that's not
trivial to implement in a backward compatible way.
Thanks Adam Sołtysik for the report and test and Clifford for the review.
|
|
|
|
|
|
abstract models.
|
|
|
|
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.
|
|
constraints.
|
|
per deprecation timeline.
|
|
|
|
Regression in bf7b17d16d3978b2e1cee4a0f7ce8840bd1a8dc4.
Thanks Sage Abdullah for the report.
|
|
Regression in bf7b17d16d3978b2e1cee4a0f7ce8840bd1a8dc4 refs #36075.
Thanks Sage Abdullah for the report and tests.
|
|
|
|
|
|
composite primary key with default values.
|
|
This avoids many awkward checks against NOT_PROVIDED and provides symmetry
with Field.has_default() which is also the reason why it wasn't made a
property.
|
|
|
|
Meta.indexes/constraints/unique_together.
CompositePrimaryKeys are not supported in any of these options.
|
|
Thank you to Simon Charette and Sarah Boyce for the review.
Regression in 73df8b54a2fab53bec4c7573cda5ad8c869c2fd8.
|
|
Thanks Lily Foote and Simon Charette for reviews and mentoring
this Google Summer of Code 2024 project.
Co-authored-by: Simon Charette <charette.s@gmail.com>
Co-authored-by: Lily Foote <code@lilyf.org>
|
|
is set.
|
|
|
|
|
|
_get_field_value_map() and renamed to _get_field_expression_map().
|
|
Accessing generated field values on unsaved models caused a crash when
validating CheckConstraints and UniqueConstraints with expressions.
|
|
|
|
Model.save()/asave().
|
|
Model.save()/asave().
The transitional logic added to deprecate the usage of *args for
Model.save()/asave() introduced two issues that this branch fixes:
* Passing extra positional arguments no longer raised TypeError.
* Passing a positional but empty update_fields would save all fields.
Co-authored-by: Natalia <124304+nessita@users.noreply.github.com>
|
|
Affected models where the primary key field is defined with a
default or db_default, such as UUIDField.
|
|
Thanks Matt Hegarty for the report and Simon Charette and Natalia Bidart for the reviews.
Regression in f333e35.
|
|
accessing deferred fields.
Regression in a7b5ad8b19a08d7d57302ece74f6e26d2887fd9f for reverse
relations and possibly in 123b1d3fcf79f091573c40be6da7113a6ef35b62 for
private fields.
|
|
|
|
validating empty values.
Thanks Brian Ibbotson for the report.
Regression in 7414704e88d73dafbcfbb85f9bc54cb6111439d3.
|
|
|
|
co-authored-by: Keryn Knight <keryn@kerynknight.com>
co-authored-by: Natalia <124304+nessita@users.noreply.github.com>
co-authored-by: David Smith <smithdc@gmail.com>
co-authored-by: Paolo Melchiorre <paolo@melchiorre.org>
|
|
get_attname()/get_attname_column().
|