Skip to content

Commit

Permalink
Added CLA info and gravator/robohash to user profile pages.
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobian committed Sep 11, 2011
1 parent 68f56c5 commit bb010b9
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 13 deletions.
9 changes: 8 additions & 1 deletion 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)
54 changes: 42 additions & 12 deletions 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 %}

0 comments on commit bb010b9

Please sign in to comment.