Opened 6 years ago
Closed 6 years ago
#30320 closed Uncategorized (invalid)
using deserialization object.save() is inconsistent
Reported by: | sebhaase | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 2.1 |
Severity: | Normal | Keywords: | |
Cc: | seb.haase+django@… | Triage Stage: | Unreviewed |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
using deserialization - object.save()
gives unexpected different results for auto_now=True
field.
I would consider this a bug:
- if the object-pk already exists , the
auto_now=True
field is saved as given - but if it does not exist, the given value is ignored, and the current time is used instead
If one favors auto_now=True
to mean "ignore value if given" - than that should happen in both cases.
I would prefer to use the given value, unless it is None
(or non-existent)
If you think it is bad to introduce a backward-incompatible change I would suggest to state this somewhere clearly in the documentation.
Note:
See TracTickets
for help on using tickets.
As per #30319 you need to TicketClosingReasons/UseSupportChannels for this kind of query. Clarify exactly what you mean there, with a code example likely, and you may find you get a response. (As it stands it's not at all clear what you mean.)
The issue tracker is not the place to cut and paste posts from the mailing list.