typecast obj and add a comment to the contact custom list_display for ContactAdmin

This commit is contained in:
Rachid Mrad 2023-09-11 16:06:36 -04:00
parent 2ba48edb7f
commit 2df68d4b52
No known key found for this signature in database
GPG key ID: EF38E4CEC4A8F3CF

View file

@ -264,7 +264,8 @@ class ContactAdmin(ListHeaderAdmin):
# 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.
def contact(self, obj):
def contact(self, obj: models.Contact):
""" Duplicate the contact _str_"""
if obj.first_name or obj.last_name:
return obj.get_formatted_name()
elif obj.email: