暫無描述

models.py 811B

123456789101112131415161718192021
  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 Manager'),
  8. ]
  9. user = models.OneToOneField(User, on_delete=models.CASCADE, related_name='profile')
  10. bio = models.TextField(blank=True, null=True)
  11. profile_picture = models.ImageField(upload_to="profile/%Y/%m/%d/", blank=True, null=True)
  12. signed_picture = models.ImageField(upload_to="signed/%Y/%m/%d/", blank=True, null=True)
  13. email = models.EmailField(blank=True, null=True) # New email field
  14. position = models.CharField(max_length=20, choices=POSITION_CHOICES, blank=True, null=True) # New position field
  15. def __str__(self):
  16. return self.user.username