Templates.
[cas.git] / src / accounts / models.py
1 from django.db import models
2 from cas_provider.signals import cas_collect_custom_attributes
3
4
5 class Service(models.Model):
6     ordering = models.IntegerField()
7     name = models.CharField(max_length=255)
8     url = models.URLField()
9     image = models.ImageField(upload_to='accounts/service/')
10
11     class Meta:
12         ordering = ('ordering', )
13
14
15 def user_attributes(sender, user, **kwargs):
16     return {
17         'firstname': user.first_name,
18         'lastname': user.last_name,
19         'cn': ' '.join((user.first_name, user.last_name)),
20         'email': user.email,
21     }
22 cas_collect_custom_attributes.connect(user_attributes)