Refactoring
* moves updating of shared access users into ShareableObjectMixin * renames ShareInterventionModalForm to ShareModalForm since it's used for EMA and eco accounts as well
This commit is contained in:
@@ -284,25 +284,6 @@ class Intervention(BaseObject, ShareableObjectMixin, RecordableObjectMixin, Chec
|
||||
)
|
||||
return deduction
|
||||
|
||||
def update_sharing_user(self, form):
|
||||
""" Adds a new user with shared access to the intervention
|
||||
|
||||
Args:
|
||||
form (ShareInterventionModalForm): The form holding the data
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
form_data = form.cleaned_data
|
||||
|
||||
keep_accessing_users = form_data["users"]
|
||||
new_accessing_users = list(form_data["user_select"].values_list("id", flat=True))
|
||||
accessing_users = keep_accessing_users + new_accessing_users
|
||||
users = User.objects.filter(
|
||||
id__in=accessing_users
|
||||
)
|
||||
self.share_with_list(users)
|
||||
|
||||
|
||||
class InterventionDocument(AbstractDocument):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user