From 66381548398d9a56200a766cf2368110b7265be2 Mon Sep 17 00:00:00 2001 From: Jorrit Boekel Date: Mon, 16 Dec 2024 14:16:14 +0100 Subject: [PATCH] Fix bug in dataset owner adding, missed that when doing values() calls everywhere --- src/backend/datasets/views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backend/datasets/views.py b/src/backend/datasets/views.py index 64e4bc87..14a46bad 100644 --- a/src/backend/datasets/views.py +++ b/src/backend/datasets/views.py @@ -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: