暫無描述

models.py 963B

1234567891011121314151617181920212223
  1. from django.db import models
  2. # Create your models here.
  3. from django.contrib.auth.models import User
  4. class UserProfile(models.Model):
  5. POSITION_CHOICES = [
  6. ('QA_STAFF', 'QA Staff'),
  7. ('QA_MANAGER', 'QA. MG.'),
  8. ('QA_AST_MANAGER', 'QA. Asst. MG.'),
  9. ('QA_ENGINEER', 'QA. Engineer'),
  10. ]
  11. user = models.OneToOneField(User, on_delete=models.CASCADE, related_name='profile')
  12. bio = models.TextField(blank=True, null=True)
  13. profile_picture = models.ImageField(upload_to="profile/%Y/%m/%d/", blank=True, null=True)
  14. signed_picture = models.ImageField(upload_to="signed/%Y/%m/%d/", blank=True, null=True)
  15. email = models.EmailField(blank=True, null=True) # New email field
  16. position = models.CharField(max_length=20, choices=POSITION_CHOICES, blank=True, null=True) # New position field
  17. def __str__(self):
  18. return f"{self.user.username} / {self.user.first_name} {self.user.last_name} #{self.position}"