Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

132
Views
django 1.10 - custom sql inserts when user registered

I am using django 1.10 + django-registration 2.2 (HMAC activation workflow). How can I make custom sql inserts when a new user is registered? For example every user has own settings and after registration I want to insert the default settings in the sql table for this user. Later the user can change these settings.

What is the common approach? Do I have to edit the django-registration 2.2 files?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

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

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!