summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRalph Bean <rbean@redhat.com>2013-12-05 11:34:17 -0500
committerRalph Bean <rbean@redhat.com>2013-12-05 11:34:17 -0500
commitccdf7c36ca26518ee5adf0c9a812ec541119c7ee (patch)
tree908f1843794a356c11845fb08fda54ef139ff984
parentb3ffd97a0b433647a53ecd7a5cc63f7bdc1e1ee2 (diff)
downloadhyperkitty-ccdf7c36ca26518ee5adf0c9a812ec541119c7ee.tar.gz
hyperkitty-ccdf7c36ca26518ee5adf0c9a812ec541119c7ee.tar.xz
hyperkitty-ccdf7c36ca26518ee5adf0c9a812ec541119c7ee.zip
Add support for libravatar.org
-rw-r--r--hyperkitty/templates/user_profile.html4
-rw-r--r--hyperkitty/views/accounts.py7
2 files changed, 9 insertions, 2 deletions
diff --git a/hyperkitty/templates/user_profile.html b/hyperkitty/templates/user_profile.html
index e6cb8bd..bb9ddc0 100644
--- a/hyperkitty/templates/user_profile.html
+++ b/hyperkitty/templates/user_profile.html
@@ -67,8 +67,8 @@
</form>
<div class="gravatar">
- <a href="http://gravatar.com/">{% gravatar user.email 150 %}</a>
- <p><a href="http://gravatar.com/">Edit on gravatar.com</a></p>
+ <a href="{{ gravatar_url }}">{% gravatar user.email 150 %}</a>
+ <p><a href="{{ gravatar_url }}">Edit on {{ gravatar_shortname }}</a></p>
</div>
<div class="clearfix"></div>
diff --git a/hyperkitty/views/accounts.py b/hyperkitty/views/accounts.py
index 836d524..e7ca11d 100644
--- a/hyperkitty/views/accounts.py
+++ b/hyperkitty/views/accounts.py
@@ -138,12 +138,19 @@ def user_profile(request):
"msg": FLASH_MESSAGES[flash_msg][1] }
flash_messages.append(flash_msg)
+ # Extract the gravatar_url used by django_gravatar2. The site
+ # administrator could alternatively set this to http://cdn.libravatar.org/
+ gravatar_url = getattr(settings, 'GRAVATAR_URL', 'http://www.gravatar.com')
+ gravatar_shortname = '.'.join(gravatar_url.split('.')[-2:]).strip('/')
+
context = {
'user_profile' : user_profile,
'form': form,
'emails': emails,
'favorites': favorites,
'flash_messages': flash_messages,
+ 'gravatar_url': gravatar_url,
+ 'gravatar_shortname': gravatar_shortname,
}
return render(request, "user_profile.html", context)