Created
August 26, 2020 19:49
-
-
Save BrockHerion/26e4b938cd67821d2912144a01d2d9c8 to your computer and use it in GitHub Desktop.
Create roles to use in our application
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import uuid | |
from django.db import models | |
from django.contrib.auth.models import PermissionsMixin | |
from django.contrib.auth.base_user import AbstractBaseUser | |
from django.utils import timezone | |
from .managers import CustomUserManager | |
# Create your models here. | |
class User(AbstractBaseUser, PermissionsMixin): | |
# These fields tie to the roles! | |
ADMIN = 1 | |
MANAGER = 2 | |
EMPLOYEE = 3 | |
ROLE_CHOICES = ( | |
(ADMIN, 'Admin'), | |
(MANAGER, 'Manager'), | |
(EMPLOYEE, 'Employee') | |
) | |
class Meta: | |
verbose_name = 'user' | |
verbose_name_plural = 'users' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment