Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added CLA info and gravator/robohash to user profile pages.

  • Loading branch information...
commit bb010b9438a007a934aa1ed3a1d379d5ae1792fd 1 parent 68f56c5
@jacobian jacobian authored
View
9 django_website/accounts/views.py
@@ -1,7 +1,14 @@
+import hashlib
from django.shortcuts import render, get_object_or_404
from django.contrib.auth.models import User
+from ..cla.models import find_agreements
def user_profile(request, username):
u = get_object_or_404(User, username=username)
- ctx = {'user': u, 'user_can_commit': u.has_perm('auth.commit')}
+ ctx = {
+ 'user': u,
+ 'email_hash': hashlib.md5(u.email).hexdigest(),
+ 'user_can_commit': u.has_perm('auth.commit'),
+ 'clas': find_agreements(u),
+ }
return render(request, "accounts/user_profile.html", ctx)
View
54 django_website/templates/accounts/user_profile.html
@@ -1,20 +1,50 @@
{% extends "base_community.html" %}
{% block title %}{{ user }} | djangoproject.com{% endblock %}
+{% block extrahead %}
+ <style type="text/css">
+ #avatar { float: left; margin-top: 16px; }
+ #user-info { padding-left: 150px; }
+ #user-info ul { padding-left: 48px; }
+ </style>
+{% endblock extrahead %}
{% block content-related %}{% endblock %}
{% block content %}
- <h1>{% firstof user.get_full_name user.username %}</h1>
- <p>Member since {{ user.date_joined.date }}.</p>
- {% if user_can_commit %}<p>Committer!</p>{% endif %}
- {% with user.owned_feeds.all as feeds %}
- {% if feeds %}
- <h2>Community feeds:</h2>
- <li>
- {% for f in feeds %}
- <li><a href="{{ f.public_url }}">{{ f.title }}</a></li>
- {% endfor %}
- </li>
+ <img id='avatar' width='150' height='150'
+ src="http://robohash.org/{{ email_hash }}?gravatar=hashed&amp;set=set3">
+ <div id="user-info">
+ <h1>{% firstof user.get_full_name user.username %}</h1>
+ <p>
+ Member since {{ user.date_joined.date }}.
+ </p>
+ {% if user_can_commit %}<p>Committer!</p>{% endif %}
+ {% if clas %}
+ {% for cla in clas %}
+ {% if cla.ccla %}
+ {# it's a corporate cla #}
+ <p>
+ Contributions covered by CLA on file for {{ cla.ccla.company_name }}
+ (signed {{ cla.ccla.date_signed }}).
+ </p>
+ {% else %}
+ <p>
+ CLA on file (signed {{ cla.date_signed }}).
+ </p>
+ {% endif %}
+ {% endfor %}
{% endif %}
- {% endwith %}
+ {% with user.owned_feeds.all as feeds %}
+ {% if feeds %}
+ <h2>Community feeds:</h2>
+ <ul>
+ <li>
+ {% for f in feeds %}
+ <li><a href="{{ f.public_url }}">{{ f.title }}</a></li>
+ {% endfor %}
+ </li>
+ </ul>
+ {% endif %}
+ {% endwith %}
+ </div>
{% endblock content %}
Please sign in to comment.
Something went wrong with that request. Please try again.