Ticket #30966: models.py
File models.py, 475 bytes (added by , 5 years ago) |
---|
Line | |
---|---|
1 | import uuid |
2 | |
3 | from django.contrib.auth.models import AbstractBaseUser |
4 | from django.db import models |
5 | |
6 | |
7 | def uuid_hex(): |
8 | return uuid.uuid4().hex |
9 | |
10 | |
11 | class User(AbstractBaseUser): |
12 | id = models.CharField(primary_key=True, max_length=32, default=uuid_hex, editable=False) |
13 | email = models.EmailField(max_length=191, unique=True) |
14 | |
15 | USERNAME_FIELD = 'email' |
16 | |
17 | |
18 | class Domain(models.Model): |
19 | owner = models.ForeignKey(User, on_delete=models.PROTECT, related_name='domains') |
20 |