Skip to content

Commit

Permalink
Merge pull request #1036 from opengisch/patch_project
Browse files Browse the repository at this point in the history
Improve the project patch endpoint
  • Loading branch information
suricactus authored Sep 23, 2024
2 parents 8c5d0fc + be590b0 commit 91aa976
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
12 changes: 12 additions & 0 deletions docker-app/qfieldcloud/core/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,18 @@ class Meta:
"user_role",
"user_role_origin",
)
read_only_fields = (
"private",
"created_at",
"updated_at",
"data_last_packaged_at",
"data_last_updated_at",
"can_repackage",
"needs_repackaging",
"status",
"user_role",
"user_role_origin",
)
model = Project


Expand Down
4 changes: 2 additions & 2 deletions docker-app/qfieldcloud/core/views/projects_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def get_queryset(self):
return projects

@transaction.atomic
def perform_update(self, serializer):
def perform_update(self, serializer: ProjectSerializer) -> None:
# Here we do an additional check if the owner has changed. If so, the reciever
# of the project must have enough storage quota, otherwise the transfer is
# not permitted.
Expand All @@ -111,7 +111,7 @@ def perform_update(self, serializer):

# If owner has not changed, no additional check is made
if old_owner == new_owner:
return
return None

# Owner has changed, we must ensure he has enough quota for that
# (in this transaction, the project is his already, so we just need to
Expand Down

0 comments on commit 91aa976

Please sign in to comment.