Friday, October 9, 2015

Re: formset concurrency control

Hi Tim,

Am 08.10.2015 um 21:03 schrieb Tim Graham:
> I think the problem is also described in https://code.djangoproject.com/ticket/15574.
> Probably if we had a simple solution, that ticket wouldn't be open for 5 years. :-)

:-)

Yes, having read all of it, I too think that #15574 describes the same problem.

The more I think about it, reconstructing the queryset in the POST request by the same
parameters that were used to construct the queryset for the initial formset data in the
GET request, in *addition* to the primary keys in the POST request, seems like an
increasingly good idea to me:

In formset validation, comparing the queryset objects with the PKs from the POST request
should yield an exact match (validation successful).

If there is any mismatch, it is probably best to just tell the user that there was a
problem (in some specific cases it might be possible to fix and/or communicate the
mismatch, but not generally). He/she may lose some work (has to reload and fill in the
entire form again), but that still seems a lot better to me than saving something that
the user has not seen (or seen differently) and may come entirely surprising.

This approach looks reasonably simple and stable to me, and I'll definitively try it
out. As a second but independent step, it should even be relatively easy to add
fine-grained concurrency control to it as mentioned in my first post.

As always, any additional comments or thoughts would very much be appreciated!

Best regards,
Carsten

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/5617D9F4.6070901%40cafu.de.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment