Skip to content

Commit

Permalink
Merge pull request #823 from opengisch/QF-3353-team-unprefix
Browse files Browse the repository at this point in the history
  • Loading branch information
suricactus authored Nov 13, 2023
2 parents ed77bff + cef994e commit 86c733c
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions docker-app/qfieldcloud/core/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -1268,6 +1268,22 @@ def save_model(self, request, obj, form, change):
obj.username = f"@{obj.team_organization.username}/{obj.username}"
obj.save()

def get_form(
self,
request: Any,
obj: Any | None = None,
change: bool | None = None,
**kwargs: Any,
) -> Any:
if obj:
# hide the organization prefix of the team, so the Team admin can be saved without
# the need to manually edit the username
obj.username = obj.username.replace(
f"@{obj.team_organization.username}/", ""
)

return super().get_form(request, obj, bool(change), **kwargs)


class InvitationAdmin(InvitationAdminBase):
list_display = ("email", "inviter", "created", "sent", "accepted")
Expand Down

0 comments on commit 86c733c

Please sign in to comment.