From: Radek Czajka Date: Thu, 27 Mar 2014 14:15:21 +0000 (+0100) Subject: Serve user extended attributes. X-Git-Url: https://git.mdrn.pl/cas.git/commitdiff_plain/0dd89aae9312bb35ea3398bc9cbf4312ac8d5003?ds=inline Serve user extended attributes. Also: update to Django 1.6. --- diff --git a/requirements.txt b/requirements.txt index f51d854..ffd8cdb 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,8 +1,8 @@ -i http://pypi.nowoczesnapolska.org.pl/simple -Django>=1.5,<1.6 +Django>=1.6,<1.7 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 diff --git a/src/accounts/models.py b/src/accounts/models.py index 126fc11..c9aaec6 100644 --- a/src/accounts/models.py +++ b/src/accounts/models.py @@ -1,4 +1,5 @@ from django.db import models +from cas_provider.signals import cas_collect_custom_attributes class Service(models.Model): @@ -9,3 +10,12 @@ class Service(models.Model): 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) diff --git a/src/accounts/templates/account/profile.html b/src/accounts/templates/account/profile.html index bc576d9..b7cc601 100644 --- a/src/accounts/templates/account/profile.html +++ b/src/accounts/templates/account/profile.html @@ -3,7 +3,7 @@ {% block content %}