Django IntegrityError on user signup

519 Views Asked by At

I am getting an error when I try to extend user profile using django-allauth

Exception Type: IntegrityError at /accounts/signup/
Exception Value: workerapp_userprofile.user_id may not be NULL

This is my models.py in my workerapp app of my django project where I am asking for two additional fields along with other signup information.

from django.db import models
from django.contrib.auth.models import User

class UserProfile(models.Model):
  # This line is required. Links UserProfile to a User model instance.
  user    = models.OneToOneField(User, unique=True)
  # The additional attributes we wish to include.
  website = models.URLField(blank=True)
  picture = models.ImageField(upload_to='profile_images', blank=True)

  # Override the __unicode__() method to return out something meaningful!
  def __unicode__(self):
    return self.user.username

My user is saving correctly which I can see in the admin, it's just the showing this error during the signup.

0

There are 0 best solutions below