Skip to content

Instantly share code, notes, and snippets.

@BrockHerion
Created August 26, 2020 19:49
Show Gist options
  • Save BrockHerion/26e4b938cd67821d2912144a01d2d9c8 to your computer and use it in GitHub Desktop.
Save BrockHerion/26e4b938cd67821d2912144a01d2d9c8 to your computer and use it in GitHub Desktop.
Create roles to use in our application
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