F.K
F.K

Reputation: 77

Django email account verification

I am currently working on a Django project and I am trying to add Django user email account verification. Everything looks fine, but after I receive the email and try to activate the account with the activation URL I get the following error:

OperationalError at /activate/h46fdg5h46fdg5h46fdghfd8hfdhfd48hfd4h6
no such table: registry_profile

here is my activation code in 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())

Here is my models.py file:

class Profile(models.Model):
    user = models.OneToOneField(User, related_name='profile')
    activation_key = models.CharField(max_length = 50)
    key_expires = models.DateTimeField()

Upvotes: 0

Views: 142

Answers (1)

F.K
F.K

Reputation: 77

Yes. I got it. I had to run:

>>> manage.py makemigrations registry

and then :

>>> manage.py migrate

for more information look at:

Django Migrations

Upvotes: 1

Related Questions