#34112: Add async-compatible interface to Model
-------------------------------------+-------------------------------------
               Reporter:  Adam       |          Owner:  nobody
  Johnson                            |
                   Type:  New        |         Status:  new
  feature                            |
              Component:  Database   |        Version:  dev
  layer (models, ORM)                |
               Severity:  Normal     |       Keywords:
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 Following #33646, it would be convenient to also have an async interface
 on `Model` methods that use the database:

 * `Model.asave()` to mirror `save()`
 * `Model.adelete()` to mirror `delete()`
 * `Model.arefresh_from_db()` to mirror `refresh_from_db()`

 Allowing usage like:

 {{{
 book = await Book.objects.aget(title=title)
 book.pages = ...
 await book.asave()
 }}}

 There’s already a way to effectively call save for new objects only,
 through the `QuerySet.acreate()` method, exposed on managers.

 `Model` also has some database-touching methods used in form validation,
 like `validate_constraints()`. But if we aren’t intending on exposing the
 forms API as async, yet, then these could be deferred

-- 
Ticket URL: <https://code.djangoproject.com/ticket/34112>
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 on the web visit 
https://groups.google.com/d/msgid/django-updates/01070183fb5ef3d5-8c5926d8-6c39-4f6f-92d5-22b09c3b2fd3-000000%40eu-central-1.amazonses.com.

Reply via email to