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.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

26 lines
885 B

  1. from django.db import models
  2. from common.models import BankDetails, Address
  3. class Department(models.Model):
  4. name = models.CharField(max_length=50)
  5. def __str__(self):
  6. return self.name
  7. class Employee(models.Model):
  8. first_name = models.CharField(max_length=30)
  9. last_name = models.CharField(max_length=30)
  10. personal_email = models.EmailField(unique=True)
  11. official_email = models.EmailField(unique=True)
  12. phone_number = models.CharField(max_length=13)
  13. address = models.ForeignKey(Address, on_delete=models.SET_NULL, null=True)
  14. job_title = models.CharField(max_length=100)
  15. department = models.ManyToManyField(Department)
  16. ctc = models.DecimalField(max_digits=10, decimal_places=2)
  17. bank_details = models.OneToOneField(BankDetails, on_delete=models.CASCADE)
  18. def __str__(self):
  19. return f"{self.first_name} {self.last_name}"