Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added CLA info and gravator/robohash to user profile pages.
- Loading branch information
Showing
2 changed files
with
50 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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&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 %} |