Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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

  • Loading branch information...
commit bb010b9438a007a934aa1ed3a1d379d5ae1792fd 1 parent 68f56c5
Jacob Kaplan-Moss authored September 11, 2011
9  django_website/accounts/views.py
... ...
@@ -1,7 +1,14 @@
  1
+import hashlib
1 2
 from django.shortcuts import render, get_object_or_404
2 3
 from django.contrib.auth.models import User
  4
+from ..cla.models import find_agreements
3 5
 
4 6
 def user_profile(request, username):
5 7
     u = get_object_or_404(User, username=username)
6  
-    ctx = {'user': u, 'user_can_commit': u.has_perm('auth.commit')}
  8
+    ctx = {
  9
+        'user': u,
  10
+        'email_hash': hashlib.md5(u.email).hexdigest(),
  11
+        'user_can_commit': u.has_perm('auth.commit'),
  12
+        'clas': find_agreements(u),
  13
+    }
7 14
     return render(request, "accounts/user_profile.html", ctx)
54  django_website/templates/accounts/user_profile.html
... ...
@@ -1,20 +1,50 @@
1 1
 {% extends "base_community.html" %}
2 2
 
3 3
 {% block title %}{{ user }} | djangoproject.com{% endblock %}
  4
+{% block extrahead %}
  5
+  <style type="text/css">
  6
+    #avatar { float: left; margin-top: 16px; }
  7
+    #user-info { padding-left: 150px; }
  8
+    #user-info ul { padding-left: 48px; }
  9
+  </style>
  10
+{% endblock extrahead %}
4 11
 {% block content-related %}{% endblock %}
5 12
 
6 13
 {% block content %}
7  
-  <h1>{% firstof user.get_full_name user.username %}</h1>
8  
-  <p>Member since {{ user.date_joined.date }}.</p>
9  
-  {% if user_can_commit %}<p>Committer!</p>{% endif %}
10  
-  {% with user.owned_feeds.all as feeds %}
11  
-    {% if feeds %}
12  
-      <h2>Community feeds:</h2>
13  
-      <li>
14  
-        {% for f in feeds %}
15  
-          <li><a href="{{ f.public_url }}">{{ f.title }}</a></li>   
16  
-        {% endfor %}
17  
-      </li>
  14
+  <img id='avatar' width='150' height='150'
  15
+       src="http://robohash.org/{{ email_hash }}?gravatar=hashed&amp;set=set3">
  16
+  <div id="user-info">
  17
+    <h1>{% firstof user.get_full_name user.username %}</h1>
  18
+    <p>
  19
+      Member since {{ user.date_joined.date }}.
  20
+    </p>
  21
+    {% if user_can_commit %}<p>Committer!</p>{% endif %}
  22
+    {% if clas %}
  23
+      {% for cla in clas %}
  24
+        {% if cla.ccla %}
  25
+          {# it's a corporate cla #}
  26
+          <p>
  27
+            Contributions covered by CLA on file for {{ cla.ccla.company_name }}
  28
+            (signed {{ cla.ccla.date_signed }}).
  29
+          </p>
  30
+        {% else %}
  31
+          <p>
  32
+            CLA on file (signed {{ cla.date_signed }}).
  33
+          </p>
  34
+        {% endif %}
  35
+      {% endfor %}
18 36
     {% endif %}
19  
-  {% endwith %}
  37
+    {% with user.owned_feeds.all as feeds %}
  38
+      {% if feeds %}
  39
+        <h2>Community feeds:</h2>
  40
+        <ul>
  41
+          <li>
  42
+            {% for f in feeds %}
  43
+              <li><a href="{{ f.public_url }}">{{ f.title }}</a></li>   
  44
+            {% endfor %}
  45
+          </li>
  46
+        </ul>
  47
+      {% endif %}
  48
+    {% endwith %}
  49
+  </div>
20 50
 {% endblock content %}

0 notes on commit bb010b9

Please sign in to comment.
Something went wrong with that request. Please try again.