From 67626a59d9f54fdf90336c2eb275c80841a37bee Mon Sep 17 00:00:00 2001 From: Michael Hall Date: Tue, 4 Sep 2018 22:45:49 -0400 Subject: [PATCH] Use a team's custom image for social media previews of their events --- events/models/profiles.py | 8 ++++++++ .../templates/get_together/events/show_event.html | 6 +----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/events/models/profiles.py b/events/models/profiles.py index 6c283fc..ff03be8 100644 --- a/events/models/profiles.py +++ b/events/models/profiles.py @@ -383,6 +383,14 @@ class Team(models.Model): else: return static('img/team_placeholder.png') + @property + def full_img_url(self): + if self.card_img_url.startswith('http'): + return self.card_img_url + else: + site = Site.objects.get(id=1) + return "https://%s%s" % (site.domain, self.card_img_url) + @property def location_name(self): if self.city: diff --git a/get_together/templates/get_together/events/show_event.html b/get_together/templates/get_together/events/show_event.html index 616832f..77a281b 100644 --- a/get_together/templates/get_together/events/show_event.html +++ b/get_together/templates/get_together/events/show_event.html @@ -8,11 +8,7 @@ - {% if event.team.category %} - - {% else %} - - {% endif %} + {% endblock %} {% block styles %}