-
Notifications
You must be signed in to change notification settings - Fork 0
/
models.py
40 lines (30 loc) · 960 Bytes
/
models.py
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
39
40
from django.db import models
from django.utils.translation import ugettext_lazy as _
from datetime import datetime
from django.contrib.auth.models import AbstractBaseUser
from .managers import *
from django.contrib.auth.models import User as AuthUser, UserManager
from django.core.mail import send_mail
from django.conf import settings
class SecondUser(AbstractBaseUser):
email = models.EmailField(max_length=200, unique=True)
email_confirmed = models.BooleanField(default=False)
USERNAME_FIELD = 'email'
objects = UserManager()
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
def email_user(self, subject, message):
send_mail(
subject,
message,
settings.EMAIL_SENDER,
[self.email],
fail_silently=False,
)
return False
def subscribed():
pass
def is_staff():
return False
def __unicode__(self):
return self.email