To prevent any race condition issues when two people edit the same company at the same time, we should switch from using .get() to .select_for_update() when retrieving the company to be edited.
In helloworld/views.py, we retrieve the company to be edited like this:
company = Company.objects.get(id = id)
... edit logic
that should instead use .select_for_update(), which causes the object to be locked across all other transactions happening, preventing any double-edits
To prevent any race condition issues when two people edit the same company at the same time, we should switch from using .get() to .select_for_update() when retrieving the company to be edited.
In
helloworld/views.py
, we retrieve the company to be edited like this:that should instead use .select_for_update(), which causes the object to be locked across all other transactions happening, preventing any double-edits