@@ -10,7 +10,7 @@ from django.core.exceptions import ObjectDoesNotExist
|
||||
|
||||
from konova.utils.message_templates import DEDUCTION_ADDED, REVOCATION_ADDED, DEDUCTION_REMOVED, DEDUCTION_EDITED, \
|
||||
REVOCATION_EDITED
|
||||
from user.models import User
|
||||
from user.models import User, Team
|
||||
from user.models import UserActionLogEntry
|
||||
from django.db import transaction
|
||||
from django import forms
|
||||
@@ -37,6 +37,20 @@ class ShareModalForm(BaseModalForm):
|
||||
}
|
||||
)
|
||||
)
|
||||
team_select = forms.ModelMultipleChoiceField(
|
||||
label=_("Add team to share with"),
|
||||
label_suffix="",
|
||||
help_text=_("Multiple selection possible - You can only select teams which do not already have access."),
|
||||
required=False,
|
||||
queryset=Team.objects.all(),
|
||||
widget=autocomplete.ModelSelect2Multiple(
|
||||
url="share-team-autocomplete",
|
||||
attrs={
|
||||
"data-placeholder": _("Click for selection"),
|
||||
"data-minimum-input-length": 3,
|
||||
},
|
||||
),
|
||||
)
|
||||
user_select = forms.ModelMultipleChoiceField(
|
||||
label=_("Add user to share with"),
|
||||
label_suffix="",
|
||||
@@ -97,6 +111,13 @@ class ShareModalForm(BaseModalForm):
|
||||
self.disable_form_field("users")
|
||||
|
||||
self._add_user_choices_to_field()
|
||||
self._add_teams_to_field()
|
||||
|
||||
def _add_teams_to_field(self):
|
||||
form_data = {
|
||||
"teams": []
|
||||
}
|
||||
self.load_initial_data(form_data)
|
||||
|
||||
def _add_user_choices_to_field(self):
|
||||
""" Transforms the instance's sharing users into a list for the form field
|
||||
|
||||
Reference in New Issue
Block a user