#36888: acreate method doesn't call asave
-------------------------------------+-------------------------------------
Reporter: Materson | Owner: @…
Type: Bug | Status: assigned
Component: Database | Version: 6.0
layer (models, ORM) |
Severity: Normal | Keywords: acreate asave
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 0 |
-------------------------------------+-------------------------------------
acreate doesn't call asave method.
When you use async Django methods and you want to add custom logic in
asave method, when you create your object with acreate, it doesn't call
your asave method.
{{{
class SimpleModel(models.Model):
field = models.IntegerField()
async def asave(self, *args, **kwargs):
self.field += 1
await super().asave(*args, **kwargs)
obj = await SimpleModel.objects.acreate(field=4)
obj.field # returns 4, should be 5
}}}
When you run create, it calls save().
--
Ticket URL: <https://code.djangoproject.com/ticket/36888>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/django-updates/0107019c00fa555d-966b092a-27e4-49b0-92cd-b24670bcf25c-000000%40eu-central-1.amazonses.com.