1 year ago
#311051
vis viz
Django type object 'Account' has no attribute 'USERNAME_FIELD' django
i tried to adding username=None didnt work Account model is for auth
other models that are diffrent languge are just profile pic or date joined nothing important to the error i imagine
models.py
class Account(AbstractBaseUser):
email= models.EmailField(verbose_name='ایمیل', max_length=60, unique=True)
username = models.CharField(max_length=255, unique=True)
مسکن = models.CharField(max_length=255)
تاریخ_ثبت_نام = models.DateTimeField(verbose_name='تاریخ_ثبت_نام', auto_now_add=True)
اخرین_ورود = models.DateTimeField(verbose_name='اخرین_ورود', auto_now=True)
is_admin = models.BooleanField(default=False)
is_active = models.BooleanField(default=True)
is_staff = models.BooleanField(default=False)
is_superuser = models.BooleanField(default=False)
عکس_پروفایل = models.ImageField(max_length=255 ,upload_to=get_profile_image_filepath,null=True ,blank=True, default=get_default_profile_image)
objects = MyAccountManager()
USERNAME_FIELD = 'email'
REQUIRED_FIELDS = ['username']
def __str__(self):
return self.username
def get_profile_image_filenames(self):
return str(self.عکس_پروفایل)[str(self.عکس_پروفایل).index(f'uploads/{self.pk})/'):]
def has_perm(self,perm, obj=None):
return self.is_admin
def has_module_perm(self , applabel):
return True
django
django-models
django-users
0 Answers
Your Answer