From 2ffeda3be7340e9294f9ece9f0cd2d3892a19281 Mon Sep 17 00:00:00 2001 From: David Kennedy Date: Mon, 15 Apr 2024 07:46:07 -0400 Subject: [PATCH] added column for Is user to Contact table in DJA --- src/registrar/admin.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/registrar/admin.py b/src/registrar/admin.py index 05bfc06b6..5116888dd 100644 --- a/src/registrar/admin.py +++ b/src/registrar/admin.py @@ -663,6 +663,7 @@ class ContactAdmin(ListHeaderAdmin): list_display = [ "contact", "email", + "user_exists", ] # this ordering effects the ordering of results # in autocomplete_fields for user @@ -679,6 +680,12 @@ class ContactAdmin(ListHeaderAdmin): change_form_template = "django/admin/email_clipboard_change_form.html" + def user_exists(self, obj): + """Check if the Contact has a related User""" + return obj.user is not None + user_exists.boolean = True + user_exists.short_description = "Is user" + # We name the custom prop 'contact' because linter # is not allowing a short_description attr on it # This gets around the linter limitation, for now.