summaryrefslogtreecommitdiff
path: root/drupal_auth/models.py
blob: 3ad6ffbc96291cd88429408f0f28d10c07bbf6db (plain)
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
32
33
34
35
36
37
38
from django.db import models
from django.contrib.auth.models import User
from django.contrib.auth.models import (
    BaseUserManager, AbstractBaseUser
)

from drupal_auth.managers import DrupalUserManager

class Users(models.Model):
    id = models.IntegerField(primary_key=True, db_column='uid')
    username = models.CharField(max_length=60L, unique=True, db_column='name')
    password = models.CharField(max_length=32L, db_column='pass') # Field renamed because it was a Python reserved word.
    last_login = models.DateTimeField(auto_now_add=True)

    USERNAME_FIELD = 'username'
    REQUIRED_FIELDS = []
    objects = DrupalUserManager()

    def __unicode__(self):
        return self.username

    class Meta:
        db_table = 'users'

    def is_authenticated(self):
        return True

    def is_active(self):
        return True

    def is_staff(self):
        return True

    def has_perm(self, perm, obj=None):
        return True

    def has_module_perms(self, app_label):
        return True