Open jochenklar opened 2 weeks ago
could it give race conditions when I click a lot of checkboxes or another user is simultaneously clicking the same checkboxes?
For your example I guess not right, since it only gets the page
??
The signal is fired when the value is actually saved, so no additional race conditions should emerge (I think). The value itself is in instance
in my example. If a value is changed by a handler and somebody else wants to edit the same value, the same ValidationError
would happen as if two people would change values at the same time.
Looks good to me. Interview seems to work. Did not test it with custom signals, yet.
An idea by @MarcoReidelbach: the front-end can also provide set_prefix
, set_index
, collection_index
, and set_collection
.
Maybe we also add those explicetly to the signal so that they don't need to be collected from the request (which should stay nevertheless, I guess).
This PR is a small spin-of from https://github.com/rdmorganiser/rdmo/pull/1188, because I would like to have some feedback on the idea.
The PR adds 3 custom django signals
value_created
,value_deleted
, andvalue_updated
, which are fired when Values are created, updated or deleted through the interface. The front-end provides the API with the page the user in on, and this can be used in a handler to get all attributes on the current page like this:The main benefit is that plugins/custom django apps could use them to manipulate answers on the same page without complicated queries.