From 9f6144732602b364fcec414e3053b61f7623c334 Mon Sep 17 00:00:00 2001 From: Zak Timson Date: Thu, 17 Aug 2017 14:46:44 -0400 Subject: [PATCH] Fixed phone number display and default image --- charter_members/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/charter_members/models.py b/charter_members/models.py index 353b7f4..ddc1395 100644 --- a/charter_members/models.py +++ b/charter_members/models.py @@ -13,7 +13,7 @@ class Attorney(models.Model): biography = models.TextField(blank=True, null=True) email = models.CharField(max_length=255, blank=True, null=True) front_page = models.BooleanField(default=False) - image = models.ImageField(upload_to='portraits', default='silhouette.png') + image = models.ImageField(upload_to='portraits', default='portraits/silhouette.png') joined = models.DateField(blank=True, null=True) name = models.CharField(max_length=100) phone = models.CharField(max_length=10, blank=True, null=True) @@ -21,7 +21,7 @@ class Attorney(models.Model): website = models.CharField(max_length=255, blank=True, null=True) def phone_formatted(self): - if self.phone is None: return '' + if self.phone is None or self.phone == '': return '' return f'({self.phone[:3]}) {self.phone[3:6]}-{self.phone[6:]}' phone_formatted.short_description = 'Phone'