Concurrent Web Access and Edits

18 views
Skip to first unread message

Doug Blank

unread,
Aug 11, 2009, 10:14:08 AM8/11/09
to Django users
New Django user here with a question about the client side: Is there
built-in support for dealing with concurrent edits? I'm not referring
to the database issues (locking, etc) but is there Django support for
handling a request to access or edit data for which another user is
editing?

I'm thinking about simple timestamps, detection of changed data, and
showing the user options to abort, overwrite, or re-edit.

Does one have to implement this for saving data? Anything I should
read that covers this or related topic? I couldn't find anything on
the Django site, nor in this forum.

Thanks for any pointers!

-Doug

Russell Keith-Magee

unread,
Aug 12, 2009, 7:15:28 AM8/12/09
to django...@googlegroups.com

The short answer is that Django doesn't provide any such protection
out of the box. There has been a little bit of discussion about this
feature (some of it over the last day or so), but a turnkey solution
is still a way off.

In the interim, you're might be able to hack together a solution using
a timestamp column on your model and a custom form field that renders
as a hidden field, and validates by comparing the existing instance
value with the value submitted in the form. However, you'll need to do
some experimentation here - I can't point you at any simple howto
documentation.

Yours,
Russ Magee %-)

Ben Moran

unread,
Aug 12, 2009, 8:15:41 AM8/12/09
to django...@googlegroups.com
On Tue, Aug 11, 2009 at 10:14 PM, Doug Blank<doug....@gmail.com> wrote:

> New Django user here with a question about the client side: Is there

> built-in support for dealing with concurrent edits? ...
>

Maybe you want the Django condition decorator, which lets you use HTTP
headers to send an ETag or Modified date and reject the updates if
they're not correct?

http://docs.djangoproject.com/en/dev/topics/conditional-view-processing/

Reply all
Reply to author
Forward
0 new messages