Skip to content

Commit

Permalink
fix form update bug
Browse files Browse the repository at this point in the history
  • Loading branch information
dxenes1 committed Aug 5, 2021
1 parent 2a86f9e commit bb74347
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion django/mgmt/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ def update_fields_if_admin(self):
Augment the set of fields that are updatable if user had admin privileges.
"""
self.UPDATE_FIELDS = self.BASE_UPDATE_FIELDS.copy()
is_admin = self.fields.get('is_admin', False)
is_admin = self.data.get('is_admin', False)
if is_admin:
self.UPDATE_FIELDS += ['storage_type', 'bucket', 'cv_path']

Expand Down
7 changes: 7 additions & 0 deletions django/mgmt/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,13 @@ def post(self, request, collection_name, experiment_name, channel_name):
return self.get(request, collection_name, experiment_name, channel_name, perms_form=form)
elif action == 'update':
form = ChannelForm(request.POST)

# DEV NOTE: Some fields only update-able if request originates from admin
is_admin = BossPermissionManager.is_in_group(request.user, ADMIN_GRP)
data = form.data.copy()
data['is_admin'] = is_admin
form.data = data

if form.is_valid():
data = form.cleaned_update_data

Expand Down

0 comments on commit bb74347

Please sign in to comment.