diff --git a/amiibofindr/apps/profile/templatetags/__init__.py b/amiibofindr/apps/profile/templatetags/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/amiibofindr/apps/profile/templatetags/gravatar.py b/amiibofindr/apps/profile/templatetags/gravatar.py new file mode 100644 index 0000000..84ff405 --- /dev/null +++ b/amiibofindr/apps/profile/templatetags/gravatar.py @@ -0,0 +1,13 @@ +# -*- coding: utf-8 -*- +import hashlib + +from django import template + +register = template.Library() + +@register.simple_tag +def gravatar(user, size=200): + return 'https://www.gravatar.com/avatar/{}?s={}&d=mm'.format( + hashlib.md5(user.email).hexdigest(), + size + ) diff --git a/amiibofindr/templates/amiibo/amiibo-figure.html b/amiibofindr/templates/amiibo/amiibo-figure.html index 62735ec..c58f817 100644 --- a/amiibofindr/templates/amiibo/amiibo-figure.html +++ b/amiibofindr/templates/amiibo/amiibo-figure.html @@ -4,7 +4,7 @@ AMIIBO FIGURE {% endcomment %} -{% load i18n staticfiles thumbnail %} +{% load i18n staticfiles thumbnail gravatar %} {% block page_title %}{% blocktrans with collection=selected_collection.name amiibo=amiibo.name %}{{ amiibo }} amiibo from {{ collection }} in {% endblocktrans %}{{ block.super }}{% endblock %} @@ -116,7 +116,7 @@ AMIIBO FIGURE
- +
@@ -125,7 +125,7 @@ AMIIBO FIGURE {% empty %} - {% trans "No user have this amiibo available for trade :(" %} +

{% trans "No user have this amiibo available for trade :(" %}

{% endfor %} diff --git a/amiibofindr/templates/profile/main.html b/amiibofindr/templates/profile/main.html index a1a06ed..11d8f81 100644 --- a/amiibofindr/templates/profile/main.html +++ b/amiibofindr/templates/profile/main.html @@ -1,13 +1,13 @@ {% extends "_layout.html" %} -{% load i18n %} +{% load i18n gravatar %} {% block js_views %}{{ block.super }},relation{% endblock %} {% block main_content %}
-

- +

+
{{ this_user.username }}
{% blocktrans with username=this_user.username trimmed %}