Skip to content

Commit

Permalink
Fix bug in dataset owner adding, missed that when doing values() call…
Browse files Browse the repository at this point in the history
…s everywhere
  • Loading branch information
glormph committed Dec 16, 2024
1 parent 91605d0 commit 6638154
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/backend/datasets/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,10 +474,10 @@ def change_owners(request):
is_already_ownerq = dsownq.filter(user_id=data['owner'])
is_already_owner = is_already_ownerq.exists()
if data['op'] == 'add' and not is_already_owner:
newowner = models.DatasetOwner(dataset=dset, user_id=data['owner'])
newowner = models.DatasetOwner(dataset_id=dset['pk'], user_id=data['owner'])
newowner.save()
return JsonResponse({'result': 'ok'})
elif data['op'] == 'del' and is_already_owner and dset.datasetowner_set.count() > 1:
elif data['op'] == 'del' and is_already_owner and dsownq.count() > 1:
is_already_ownerq.delete()
return JsonResponse({'result': 'ok'})
else:
Expand Down

0 comments on commit 6638154

Please sign in to comment.