我在 Django 中有一個名為 Account 的模型class Account(AbstractBaseUser): email = models.EmailField(verbose_name="email", max_length=60, unique=True)我正在嘗試將電子郵件打印為 views.py 中的字符串。def fill_view(request): # ... authentication ... email = Account.objects.filter(email=user.email).first() # ... setting up forms .... can.drawString(10, 100, email)我收到以下錯誤: Exception Type: AttributeError at /fill/ Exception Value: 'Account' object has no attribute 'decode'將數據從models.py傳輸到views.py時,如何將電子郵件解碼為Django中的字符串?我發現Reddit 上的這個帖子很有幫助,它讓我相信這可能是 mySQL 的問題。
在 Django 中將用戶數據解碼為字符串
寶慕林4294392
2022-10-06 20:03:55
