izaac/jobposting/models.py
Jakub K 0b537ed1c1
All checks were successful
continuous-integration/drone Build is passing
wybór pól w wfh, employment_types
2024-03-17 17:38:47 +01:00

126 lines
4.1 KiB
Python

from django.db import models
from core.models import MyUser, AnonymousUserData
from django.utils import timezone
from datetime import timedelta
from .helpers import rename_file
class JobOffer(models.Model):
posting_options = [
('M', 'Minimal'),
('S', 'Standard'),
('P', 'Premium'),
]
status_choices = [
('A', 'Aktywna'),
('C', 'Zakończona'),
('W', 'Oczekująca na sprawdzenie'),
('R', 'Zarchiwizowana'),
]
paid_status = [
('P', 'Oplacona'),
('N', 'Nieoplacona'),
('D', 'Inny status')
]
category_choices = [
('A', 'Budownictwo'),
('B', 'IT'),
('C', 'Elektryka i Elektronika'),
('D', 'Produkcja'),
('E', 'Mechanika i konstrukcje'),
('F', 'Chemia i Biotechnologia'),
('G', 'Biomedyczne'),
('H', 'Automatyka i Robotyka'),
('I', 'Logistyka i Transport'),
('J', 'Sprzedaż'),
('Z', 'Inne')
]
experience_levels = [
('A', 'Stażysta'),
('B', 'Junior'),
('C', 'Mid'),
('D', 'Senior'),
('E', 'Lead'),
('F', 'Manager'),
('G', 'Inne'),
]
work_from_home = [
('wfh', 'Praca zdalna'),
('hyb', 'Hybrydowa'),
('off', 'Stacjonarna'),
]
employment_types = [
('B2B', 'Kontrakt B2B'),
('FT', 'Umowa o pracę'),
('MC', 'Umowa zlecenie'),
('CW', 'Umowa o dzieło'),
('INT', 'Staż'),
]
posting_option = models.CharField(max_length=1, choices=posting_options)
company_name = models.CharField(max_length=255)
name = models.CharField(max_length=255)
content = models.TextField()
min_salary = models.IntegerField()
max_salary = models.IntegerField()
require_salary = models.BooleanField(null=True, default=False)
webpage = models.CharField(max_length=255)
localization = models.CharField(max_length=255)
vat_number = models.CharField(max_length=10)
created_at = models.DateTimeField(default=timezone.now)
status = models.CharField(max_length=1, choices=status_choices, default='W')
status_paid = models.CharField(max_length=1, choices=paid_status,
default='N')
category = models.CharField(max_length=1, choices=category_choices,
default='Z')
expiration_date = models.DateTimeField(null=True, blank=True)
image = models.CharField(max_length=255, null=True, blank=True)
experience_level = models.CharField(max_length=255, choices=experience_levels, default='G')
employment_type = models.CharField(max_length=3, choices=employment_types, default='FT')
work_from_home = models.CharField(max_length=3, choices=work_from_home, default='off')
updated_at = models.DateTimeField(auto_now=True)
skill_levels = models.JSONField(null=True, blank=True, default=list)
anonymous_user_data = models.ForeignKey(AnonymousUserData,
null=True,
blank=True,
on_delete=models.SET_NULL)
created_by = models.ForeignKey(MyUser,
null=True,
blank=True,
on_delete=models.CASCADE)
first_name = models.CharField(max_length=255)
last_name = models.CharField(max_length=255)
contact_email = models.EmailField(max_length=255, null=True, blank=True)
def save(self, *args, **kwargs):
if not self.id:
self.expiration_date = self.created_at + timedelta(days=45)
super().save(*args, **kwargs)
def __str__(self):
return f"{self.name} at {self.company_name}"
class Skill(models.Model):
skill_name = models.CharField(max_length=255)
def __str__(self):
return f"{self.skill_name}"
class CompanyLogo(models.Model):
company_logo = models.ImageField(upload_to=rename_file)
company_name = models.CharField(max_length=255)
def __str__(self):
return f"{self.company_name}"