File: models.py

package info (click to toggle)
django-auth-ldap 1.2.2%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 700 kB
  • ctags: 472
  • sloc: python: 1,763; makefile: 89
file content (31 lines) | stat: -rw-r--r-- 857 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from django.db import models


# Support for testing Django 1.5's custom user models.
try:
    from django.contrib.auth.models import AbstractBaseUser
except ImportError:
    from django.contrib.auth.models import User

    TestUser = User
else:
    class TestUser(AbstractBaseUser):
        identifier = models.CharField(max_length=40, unique=True, db_index=True)

        USERNAME_FIELD = 'identifier'

        def get_full_name(self):
            return self.identifier

        def get_short_name(self):
            return self.identifier


class TestProfile(models.Model):
    """
    A user profile model for use by unit tests. This has nothing to do with the
    authentication backend itself.
    """
    user = models.OneToOneField('auth.User')
    is_special = models.BooleanField(default=False)
    populated = models.BooleanField(default=False)