Opened 8 years ago
Last modified 8 years ago
#27222 new New feature
Refresh expressions on save — at Version 1
Description (last modified by ) ¶
The use case is automatically fetching the value for expressions when saving to DB. For example:
> user = User.objects.create(username=Lower('Anssi')) > user.username == 'anssi' True
While the above feature can be simulated somewhat easily by calling refresh_from_db() after save, an in-built implementation has the ability to use RETURNING as an optimization. In addition, it seems that refreshing objects on save would be a nice default, though this might be a bit backwards incompatible in some cases.
According to the ticket's flags, the next step(s) to move this issue forward are:
- To improve the patch as described in the pull request review comments or on this ticket, then uncheck "Patch needs improvement".
If creating a new pull request, include a link to the pull request in the ticket comment when making that update. The usual format is:
[https://github.com/django/django/pull/#### PR]
.