#28344: Add for_update parameter to Model.refresh_from_db()
-------------------------------------+-------------------------------------
     Reporter:  Patryk Zawadzki      |                    Owner:  (none)
         Type:  New feature          |                   Status:  new
    Component:  Database layer       |                  Version:  dev
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Aivars Kalvāns):

 Replying to [comment:31 Simon Charette]:
 > Thanks for chiming in everyone.
 >
 > could an acceptable solution be that instead of focusing on
 `select_for_update` we'd allow a `from_queryset: QuerySet` to be passed to
 the method and would be used instead of `self.__class__._base_manager`
 when provided.
 >

 That would do it but I started thinking about what other possibilities it
 opens. Current parameters `using` and `fields` can be applied directly to
 the queryset and the whole function would be `refresh_from_queryset`
 instead of `refresh_from_db`.

 {{{
 queryset = Author.objects.using('default').only(*fields)
 author.refresh_from_queryset(queryset)
 or
 author.refresh_from_db(from_queryset=queryset)
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/28344#comment:32>
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018c59b4f392-85d14b84-3e10-4fad-92f0-e3406ab788a2-000000%40eu-central-1.amazonses.com.

Reply via email to