summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAurélien Bompard <aurelien@bompard.org>2013-12-05 09:29:44 -0800
committerAurélien Bompard <aurelien@bompard.org>2013-12-05 09:29:44 -0800
commit6674d2df7d9f846680ec4df2a835ff72d2771e99 (patch)
tree2ec9b5e7bebcacdaa28c7f8ea80a62f1ed259c8f
parentc2879639e64e0407ca4d7b2a544b3a9a307ea6c3 (diff)
parentccdf7c36ca26518ee5adf0c9a812ec541119c7ee (diff)
downloadhyperkitty-6674d2df7d9f846680ec4df2a835ff72d2771e99.tar.gz
hyperkitty-6674d2df7d9f846680ec4df2a835ff72d2771e99.tar.xz
hyperkitty-6674d2df7d9f846680ec4df2a835ff72d2771e99.zip
Merge pull request #14 from ralphbean/libravatar
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)