[Answer]-Django receiver Column 'user_id' cannot be null

1👍

You are using create wrong, you should pass the values as arguments to create. https://docs.djangoproject.com/en/1.5/ref/models/querysets/#django.db.models.query.QuerySet.create

@receiver(signup_complete)
def handle_signup_complete(user, **kwargs):
    try:
        account = Account.objects.get(user=user)
    except Account.DoesNotExist:
        account = Account.objects.create(
            user=user,
            credit_limit=0,
            balance=0,
        )

Basically, the problem is that any required fields need to be passed when creating the object.

Leave a comment