refactor
This commit is contained in:
1 parent
6f36db63a1
commit
250cdbab7f
42 files changed
+96363
-11699
No files matched your search
@@ -0,0 +1,18 @@
|
||||
from django.db import models
|
||||
from django.contrib.auth.models import User
|
||||
|
||||
|
||||
# اصلاح مدل کاربر: تبدیل به پروفایل برای حفظ امنیت و اتصال به سیستم پیشفرض جنگو
|
||||
class UserProfile(models.Model):
|
||||
UserTypeList = [
|
||||
('admin', 'admin'),
|
||||
('office', 'office'),
|
||||
('operator', 'operator'),
|
||||
]
|
||||
user = models.OneToOneField(User, on_delete=models.CASCADE, related_name='profile')
|
||||
user_type = models.CharField(max_length=10, choices=UserTypeList)
|
||||
name_family = models.CharField(max_length=200)
|
||||
create_date = models.DateTimeField(auto_now_add=True)
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.user.username} ({self.user_type})"
|
||||
Reference in new issue
Block a user