izaac/jobposting/models.py
Jakub K 51385cb1c7
All checks were successful
continuous-integration/drone Build is passing
IZAAC_BASE - poprawa modeli db
2023-11-11 21:28:21 +01:00

61 lines
2.4 KiB
Python

from django.db import models
from core.models import MyUser
from django.utils import timezone
class JobListing(models.Model):
status_choices = [
('A', 'Aktywna'),
('C', 'Zakończona'),
('W', 'Oczekująca na sprawdzenie'),
('R', 'Zarchiwizowana'),
('','')
]
paid_status = [
('P', 'Oplacona'),
('N', 'Nieoplacona'),
('D', 'Inny status')
]
company_name = models.CharField(max_length=255)
name = models.CharField(max_length=255)
content = models.TextField()
min_salary = models.DecimalField(max_digits=10, decimal_places=2)
max_salary = models.DecimalField(max_digits=10, decimal_places=2)
location = models.CharField(max_length=255)
coordinates = models.CharField(max_length=255) # rozwaz GEODJANGO
created_by = models.ForeignKey(MyUser, on_delete=models.CASCADE, related_name='job_listings')
created_at = models.DateTimeField(default=timezone.now)
status = models.CharField(max_length=1, choices=status_choices, default='A')
status_paid = models.CharField(max_length=1, choices=paid_status, default='N')
category = models.CharField(max_length=255, null=True, blank=True)
expiration_date = models.DateField(null=True, blank=True)
company_description = models.TextField(null=True, blank=True)
# company_logo = models.ImageField(upload_to='company_logos/', null=True, blank=True)
experience_level = models.CharField(max_length=255, null=True, blank=True)
contract_type = models.CharField(max_length=255, null=True, blank=True)
is_remote = models.BooleanField(default=False)
updated_at = models.DateTimeField(auto_now=True)
def __str__(self):
return f"{self.name} at {self.company_name}"
class Skill(models.Model):
name = models.CharField(max_length=255)
proficiency_choices = [
('B', 'Podstawowy'),
('A', 'Zaawansowany'),
('E', 'Ekspert'),
]
proficiency = models.CharField(max_length=1, choices=proficiency_choices)
def __str__(self):
return self.name
class JobSkill(models.Model):
job_listing = models.ForeignKey(JobListing, on_delete=models.CASCADE, related_name='job_skills')
skill = models.ForeignKey(Skill, on_delete=models.CASCADE, related_name='job_skills')
proficiency = models.CharField(max_length=255)
def __str__(self):
return f"{self.skill.name} for {self.job_listing.name} ({self.proficiency})"