Serve user extended attributes.
authorRadek Czajka <radekczajka@nowoczesnapolska.org.pl>
Thu, 27 Mar 2014 14:15:21 +0000 (15:15 +0100)
committerRadek Czajka <radekczajka@nowoczesnapolska.org.pl>
Thu, 27 Mar 2014 14:15:21 +0000 (15:15 +0100)
Also: update to Django 1.6.

requirements.txt
src/accounts/models.py
src/accounts/templates/account/profile.html
src/cas/settings.py

index f51d854..ffd8cdb 100644 (file)
@@ -1,8 +1,8 @@
 -i http://pypi.nowoczesnapolska.org.pl/simple
 
 -i http://pypi.nowoczesnapolska.org.pl/simple
 
-Django>=1.5,<1.6
+Django>=1.6,<1.7
 South
 lxml>=2.2
 South
 lxml>=2.2
-django-gravatar
+django-gravatar2
 
 
--e git+https://github.com/rczajka/django-cas-provider.git@bb0f7662eb12a838cbd339dd8b60476a73ec161b#egg=django-cas-provider
+-e git+https://github.com/rczajka/django-cas-provider.git@1d2632a20124e8d08a234486e3c2da81b23d5734#egg=django-cas-provider
index 126fc11..c9aaec6 100644 (file)
@@ -1,4 +1,5 @@
 from django.db import models
 from django.db import models
+from cas_provider.signals import cas_collect_custom_attributes
 
 
 class Service(models.Model):
 
 
 class Service(models.Model):
@@ -9,3 +10,12 @@ class Service(models.Model):
 
     class Meta:
         ordering = ('ordering', )
 
     class Meta:
         ordering = ('ordering', )
+
+
+def user_attributes(sender, user, **kwargs):
+    return {
+        'firstname': user.first_name,
+        'lastname': user.last_name,
+        'email': user.email,
+    }
+cas_collect_custom_attributes.connect(user_attributes)
index bc576d9..b7cc601 100644 (file)
@@ -3,7 +3,7 @@
 
 {% block content %}
        <aside class="user_avatar">
 
 {% block content %}
        <aside class="user_avatar">
-               <img src="{% gravatar_for_email request.user.email 120 %}"
+               <img src="{% gravatar_url request.user.email 120 %}"
             alt="Gravatar"
             title="{% trans 'Change at Gravatar.com' %}">
                <p><a href="{% url 'cas_provider.views.logout' %}">{% trans "Logout" %}</a></p>
             alt="Gravatar"
             title="{% trans 'Change at Gravatar.com' %}">
                <p><a href="{% url 'cas_provider.views.logout' %}">{% trans "Logout" %}</a></p>
index 9e0a0f4..0c8ec90 100644 (file)
@@ -75,7 +75,7 @@ INSTALLED_APPS = (
     'django.contrib.staticfiles',
 
     'cas_provider',
     'django.contrib.staticfiles',
 
     'cas_provider',
-    'gravatar',
+    'django_gravatar',
     'south',
 
     'accounts',
     'south',
 
     'accounts',