added column for Is user to Contact table in DJA

This commit is contained in:
David Kennedy 2024-04-15 07:46:07 -04:00
parent 64d0ec3f93
commit 2ffeda3be7
No known key found for this signature in database
GPG key ID: 6528A5386E66B96B

View file

@ -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.