Django 1.8
[cas.git] / src / accounts / models.py
index 71a8362..c9aaec6 100644 (file)
@@ -1,3 +1,21 @@
 from django.db import models
 from django.db import models
+from cas_provider.signals import cas_collect_custom_attributes
 
 
-# Create your models here.
+
+class Service(models.Model):
+    ordering = models.IntegerField()
+    name = models.CharField(max_length=255)
+    url = models.URLField()
+    image = models.ImageField(upload_to='accounts/service/')
+
+    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)