[Fixed]-Django 1.10 – custom sql inserts when user registered

1👍

Use django signals.

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


@post_save(sender=User)
def my_callback(sender, instance, created, **kwargs):
    """

    :param sender: 
    :param instance: user instance
    :param created: Inserted or Updated
    :param kwargs: 
    :return: 
    """
    if created is True:
        # Create custom settings for user.
        pass

https://docs.djangoproject.com/en/1.11/ref/signals/#django.db.models.signals.pre_save

Leave a comment