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.

27 rivejä
1.0 KiB

  1. from django.db import models
  2. from common.models import BankDetails, Address
  3. from django.contrib.auth.models import User
  4. class Employee(models.Model):
  5. user = models.OneToOneField(User, on_delete=models.CASCADE, related_name='employee')
  6. # Rest of the fields...
  7. role = models.ForeignKey('Role', on_delete=models.SET_NULL, null=True)
  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. ctc = models.DecimalField(max_digits=10, decimal_places=2)
  16. bank_details = models.OneToOneField(BankDetails, on_delete=models.CASCADE)
  17. def __str__(self):
  18. return f"{self.first_name} {self.last_name}"
  19. class Role(models.Model):
  20. name = models.CharField(max_length=50, unique=True)
  21. def __str__(self):
  22. return self.name