#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: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------------+-------------------------------------
Comment (by Aivars KalvÄns): {{{ with transaction.atomic(): a = Account.objects.get(id=1) with transaction.atomic(): Account.objects.select_for_update().get(id=a.pk) a.refresh_from_db() # The lock is not released here # The lock is released here }}} For `obj.with_lock` to match what is happening in the database we would have to ensure it's called outside transaction but that makes it useless when we have to acquire more than one lock -- Ticket URL: <https://code.djangoproject.com/ticket/28344#comment:23> 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/0107018c5453a19a-55aba0e4-bd3f-4428-9f87-3dd915bce390-000000%40eu-central-1.amazonses.com.