What does the select_for_update() QuerySet method do?
- A Selects rows for the next migration
- B Locks the selected rows until the end of the transaction
- C Marks rows as modified
- D Updates rows immediately
Answer
Locks the selected rows until the end of the transaction
It issues SELECT ... FOR UPDATE, preventing concurrent modification. It must be used inside an atomic block or Django raises an error.





