我目前正在开发一个Django项目,我正在尝试添加Django用户电子邮件帐户验证。一切都很好,但在收到电子邮件并尝试使用激活URL激活帐户后,我收到以下错误:
OperationalError at /activate/h46fdg5h46fdg5h46fdghfd8hfdhfd48hfd4h6
no such table: registry_profile
这是我在view.py中的激活码:
def activation(request, key):
activation_expired = False
already_active = False
profile = get_object_or_404(Profile, activation_key=key)
if profile.user.is_active == False:
if timezone.now() > profile.key_expires:
activation_expired = True
id_user = profile.user.id
else:
profile.user.is_active = True
profile.user.save()
else:
already_active = True
return render (request,'activation.html',locals())
这是我的models.py文件:
class Profile(models.Model):
user = models.OneToOneField(User, related_name='profile')
activation_key = models.CharField(max_length = 50)
key_expires = models.DateTimeField()
答案 0 :(得分:1)