diff --git a/hc/accounts/models.py b/hc/accounts/models.py index 67afdd6c..8c66ba44 100644 --- a/hc/accounts/models.py +++ b/hc/accounts/models.py @@ -338,9 +338,6 @@ class Project(models.Model): self.api_key_readonly = token_urlsafe(nbytes=24) self.save() - def team(self): - return User.objects.filter(memberships__project=self).order_by("email") - def invite_suggestions(self): q = User.objects.filter(memberships__project__owner_id=self.owner_id) q = q.exclude(memberships__project=self) diff --git a/hc/accounts/tests/test_transfer_project.py b/hc/accounts/tests/test_transfer_project.py index 6de29d70..bc25ab3e 100644 --- a/hc/accounts/tests/test_transfer_project.py +++ b/hc/accounts/tests/test_transfer_project.py @@ -97,7 +97,8 @@ class TransferProjectTestCase(BaseTestCase): self.assertEqual(self.project.owner, self.bob) # Alice, the previous owner, should now be a member - self.assertTrue(self.project.team().filter(email="alice@example.org").exists()) + m = Member.objects.get(project=self.project, user=self.alice) + self.assertEqual(m.role, Member.Role.REGULAR) def test_accept_requires_a_transfer_request(self): self.client.login(username="bob@example.org", password="password") diff --git a/hc/accounts/views.py b/hc/accounts/views.py index 10c5c778..62eb8893 100644 --- a/hc/accounts/views.py +++ b/hc/accounts/views.py @@ -457,6 +457,8 @@ def project(request, code): tr.transfer_request_date = None tr.save() + q = project.member_set.select_related("user").order_by("user__email") + ctx["memberships"] = list(q) return render(request, "accounts/project.html", ctx) diff --git a/templates/accounts/project.html b/templates/accounts/project.html index 57b7c492..d2efb516 100644 --- a/templates/accounts/project.html +++ b/templates/accounts/project.html @@ -152,7 +152,7 @@
Owner | ||
{{ m.user.email }} | {{ m.get_role_display }} | @@ -514,7 +514,7 @@ -{% if not transfer_request %} +{% if is_owner and not transfer_request %}