You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
101 lines
4.0 KiB
101 lines
4.0 KiB
from django.db import models
|
|
from django.contrib.auth.models import AbstractBaseUser, BaseUserManager
|
|
from django.contrib.auth.models import User
|
|
|
|
class CustomUserManager(BaseUserManager):
|
|
def create_user(self, phone, password=None, **extra_fields):
|
|
if not phone:
|
|
raise ValueError('The Phone number must be set')
|
|
user = self.model(phone=phone, **extra_fields)
|
|
user.set_password(password)
|
|
user.save(using=self._db)
|
|
return user
|
|
|
|
def create_superuser(self, phone, password=None, **extra_fields):
|
|
extra_fields.setdefault('is_staff', True)
|
|
extra_fields.setdefault('is_superuser', True)
|
|
return self.create_user(phone, password, **extra_fields)
|
|
|
|
|
|
class CustomUser(AbstractBaseUser):
|
|
first_name = models.CharField(max_length=50)
|
|
last_name = models.CharField(max_length=50)
|
|
phone = models.CharField(max_length=15, unique=True)
|
|
phone2 = models.CharField(max_length=15, blank=True, null=True)
|
|
company_email = models.EmailField(null=True)
|
|
personal_email = models.EmailField(null=True)
|
|
address = models.TextField(null=True)
|
|
work_location = models.CharField(max_length=100, null=True)
|
|
picture = models.ImageField(upload_to='profile_pics/', null=True)
|
|
role = models.CharField(max_length=20)
|
|
user_id = models.CharField(max_length=10, unique=True)
|
|
is_active = models.BooleanField(default=True)
|
|
is_staff = models.BooleanField(default=False)
|
|
manager_assigned = models.CharField(max_length=100, null=True)
|
|
created_at = models.DateTimeField(auto_now_add=True)
|
|
updated_at = models.DateTimeField(auto_now=True)
|
|
|
|
objects = CustomUserManager()
|
|
|
|
USERNAME_FIELD = 'phone'
|
|
|
|
|
|
# class JobPosting(models.Model):
|
|
# client = models.CharField(max_length=100)
|
|
# spoc = models.CharField(max_length=100, blank=True, null=True)
|
|
# start_date = models.DateField()
|
|
# budget_max = models.DecimalField(max_digits=10, decimal_places=2, null=True)
|
|
# budget_min = models.DecimalField(max_digits=10, decimal_places=2, null=True)
|
|
# job_description = models.TextField()
|
|
# special_instructions = models.CharField(max_length=200, blank=True, null=True)
|
|
# job_id = models.CharField(max_length=20)
|
|
# spoc_2 = models.CharField(max_length=100, blank=True, null=True)
|
|
# close_date = models.DateField()
|
|
# location = models.TextField() # Changed from CharField to TextField
|
|
# no_of_posting = models.IntegerField()
|
|
# job_type = models.CharField(max_length=20)
|
|
# header = models.CharField(max_length=200)
|
|
# experience_in_years = models.IntegerField()
|
|
#
|
|
# def set_locations(self, location_list):
|
|
# self.location = ",".join(location_list)
|
|
#
|
|
# def get_locations(self):
|
|
# return self.location.split(",")
|
|
#
|
|
# def __str__(self):
|
|
# return self.job_id
|
|
|
|
class JobPosting(models.Model):
|
|
Client = models.CharField(max_length=100, null=True, blank=True)
|
|
JobID = models.CharField(max_length=100,null=True)
|
|
Location = models.CharField(max_length=255,null=True)
|
|
SPOC = models.CharField(max_length=255,null=True)
|
|
SPOC2 = models.CharField(max_length=255, blank=True, null=True)
|
|
NoOfPosting = models.IntegerField(null=True)
|
|
StartDate = models.DateField(null=True)
|
|
CloseDate = models.DateField(null=True)
|
|
|
|
BudgetMin = models.CharField(max_length=20,null=True)
|
|
timePeriod = models.CharField(max_length=20,null=True,blank=True)
|
|
minAmount = models.CharField(max_length=20,null=True)
|
|
maxAmount = models.CharField(max_length=20,null=True)
|
|
|
|
Qualification = models.CharField(max_length=100,null=True)
|
|
Header = models.CharField(max_length=255,null=True)
|
|
JobDescription = models.TextField(null=True)
|
|
Experience_in_Yrs = models.CharField(max_length=50,null=True)
|
|
SpecialInstructions = models.TextField(blank=True, null=True)
|
|
JD = models.FileField(upload_to='JD/', null= True)
|
|
slice_JD = models.CharField(max_length=255,null=True)
|
|
|
|
|
|
# class SPOC(models.Model):
|
|
# name = models.CharField(max_length=255,null=True)
|
|
#
|
|
# def __str__(self):
|
|
# return self.name
|
|
|
|
|
|
|