Django TypeError: fromisoformat: аргумент должен быть str
введите описание изображения здесь
class UserConfirmation(BaseModel): TYPE_CHOICES = ( (VIA_PHONE, VIA_PHONE), (VIA_EMAIL, VIA_EMAIL) ) code = models.CharField(max_length=4) verify_type = models.CharField(max_length=31, choices=TYPE_CHOICES) user = models.ForeignKey('users.User', models.CASCADE, related_name='verify_codes', db_constraint=False) expiration_time = models.TimeField(null=True) is_confirmed = models.BooleanField(default=False)
def __str__(self):
return str(self.user.__str__())
def save(self, *args, **kwargs):
if not self.pk:
if self.verify_type == VIA_EMAIL:
self.expiration_tme = datetime.now() + timedelta(minutes=EMAIL_EXPIRE)
else:
self.expiration_tme = datetime.now() + timedelta(minutes=PHONE_EXPIRE)
super(UserConfirmation, self).save(*args, **kwargs)