0

Not 100% sure how to phrase the question but here is the problem:

I have a website serving documents which each have their own URL, for example: www.app/doc/1 www.app/doc/2

The website allows users to edit the documents and save the changes. I want to put a lock in place so that only one user can edit a document at a time. So, if one client has www.app/doc/1 open then noone else should be able to open the same URL.

The web app is developed in Django. Any pointers on how to do this? I know some websites are able to pick up if you have a page open in another tab and force you to pick an active tab. What is the method that they use?

Neil
  • 3,020
  • 4
  • 25
  • 48

1 Answers1

1

You can take a look at this, maybe this is what you're looking for: Protect against concurrent modification- of database entries

This also:

https://docs.djangoproject.com/en/1.11/ref/models/querysets/#select-for-update

Luis Silva
  • 173
  • 13
  • Select for update could work. Just lock the db objects and then check on page load whether the db tables are locked.. – Neil Sep 24 '19 at 14:19
  • I've never used it, but from what I've understood this was kind of what you were looking for. Anyway it will be useful for me too. – Luis Silva Sep 25 '19 at 08:24