Ticket #30966: models.py

File models.py, 475 bytes (added by Peter Thomassen, 5 years ago)
Line 
1import uuid
2
3from django.contrib.auth.models import AbstractBaseUser
4from django.db import models
5
6
7def uuid_hex():
8 return uuid.uuid4().hex
9
10
11class 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
18class Domain(models.Model):
19 owner = models.ForeignKey(User, on_delete=models.PROTECT, related_name='domains')
20
Back to Top