From 3618ba6defdd105f4aa82f1d300a512486499ab6 Mon Sep 17 00:00:00 2001 From: Michael Hall Date: Sat, 17 Mar 2018 16:21:38 -0400 Subject: [PATCH] Support both old-style avatar URLs and new-style upload avatar files --- events/models/profiles.py | 6 +++--- get_together/templates/get_together/base.html | 2 +- get_together/templates/get_together/events/show_event.html | 2 +- .../get_together/new_user/setup_1_confirm_profile.html | 2 +- get_together/templates/get_together/teams/show_team.html | 2 +- get_together/templates/get_together/users/edit_profile.html | 2 +- get_together/templates/get_together/users/show_profile.html | 2 +- requirements.txt | 6 ++++++ 8 files changed, 15 insertions(+), 9 deletions(-) diff --git a/events/models/profiles.py b/events/models/profiles.py index 993095d..ec66d89 100644 --- a/events/models/profiles.py +++ b/events/models/profiles.py @@ -45,10 +45,10 @@ class UserProfile(models.Model): return "Unknown Profile" def avatar_url(self): - if self.avatar.url.startswith('http'): - return self.avatar.url + if self.avatar.name.startswith('http'): + return self.avatar.name else: - return settings.MEDIA_URL + '/' + self.avatar.url + return self.avatar.url def get_timezone(self): try: diff --git a/get_together/templates/get_together/base.html b/get_together/templates/get_together/base.html index fd9a889..dc3351b 100644 --- a/get_together/templates/get_together/base.html +++ b/get_together/templates/get_together/base.html @@ -72,7 +72,7 @@ form { {% if request.user.is_authenticated %}