-
Notifications
You must be signed in to change notification settings - Fork 49
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
feat(interview): Value signals [6] #1190
base: interview-import-dataset
Are you sure you want to change the base?
Conversation
could it give race conditions when I click a lot of checkboxes or another user is simultaneously clicking the same checkboxes? |
The signal is fired when the value is actually saved, so no additional race conditions should emerge (I think). The value itself is in |
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 |
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). |
@cached_property | ||
def attributes(self): | ||
attributes = [self.attribute] if self.attribute else [] | ||
attributes += [descendant.attribute for descendant in self.descendants if descendant.attribute] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it not more readable just like this? standard notation for list comprehension..
attributes += [i.attribute for i in self.descendants if i.attribute]
This PR is a small spin-of from #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.