Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Opening a duplicate tab of LockableModelAdmin leaves me completely locked out #16

Open
BenSturmfels opened this issue Feb 4, 2020 · 0 comments

Comments

@BenSturmfels
Copy link

BenSturmfels commented Feb 4, 2020

  • django-lock-tokens version: 0.2.5
  • Django version: 2.2.10
  • Python version: 3.7.4
  • Operating System: Guix System

Description

For a model extending LockableModelAdmin, I load the admin change form page. Then I open the same change form in a second tab. The second tab shows "You cannot edit this object". Now when attempting to save the first tab, you also see "You cannot edit this object". From then on I am fully locked out until the timeout, regardless of what I do.

Given that the lock token is stored on the session which is shared between tabs, probably the second tab should just renew the lock taken out by the first tab, even though this would allow you to overwrite on your own work.

I believe that the issue occurs because lock_for_session() deletes the reference to the lock out of the session dictionary before it attempts to lock. Locking then fails, leaving us without the original lock token.

Thanks for the useful package! Excellent docs too!

@BenSturmfels BenSturmfels changed the title Opening a duplicate tab of LockableModelAdmin leaves you completely locked out Opening a duplicate tab of LockableModelAdmin leaves me completely locked out Feb 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant