From 6ef2ae1403d4089f89c1298205102f943dfef29b Mon Sep 17 00:00:00 2001 From: Adrienne Stilp Date: Thu, 30 May 2024 15:15:43 -0700 Subject: [PATCH] Use custom manager methods to access queryset of active accounts --- anvil_consortium_manager/audit/audit.py | 2 +- anvil_consortium_manager/views.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/anvil_consortium_manager/audit/audit.py b/anvil_consortium_manager/audit/audit.py index 44737d67..6f1db29e 100644 --- a/anvil_consortium_manager/audit/audit.py +++ b/anvil_consortium_manager/audit/audit.py @@ -165,7 +165,7 @@ class AccountAudit(AnVILAudit): def run_audit(self): # Only checks active accounts. - for account in models.Account.objects.filter(status=models.Account.ACTIVE_STATUS).all(): + for account in models.Account.objects.active(): model_instance_result = ModelInstanceResult(account) if not account.anvil_exists(): model_instance_result.add_error(self.ERROR_NOT_IN_ANVIL) diff --git a/anvil_consortium_manager/views.py b/anvil_consortium_manager/views.py index 20b9c0f6..b493391e 100644 --- a/anvil_consortium_manager/views.py +++ b/anvil_consortium_manager/views.py @@ -630,7 +630,7 @@ def get_selected_result_label(self, item): def get_queryset(self): # Only active accounts. - qs = models.Account.objects.filter(status=models.Account.ACTIVE_STATUS).order_by("email") + qs = models.Account.objects.active().order_by("email") # Use the account adapter to process the query. adapter = get_account_adapter()