In my application, I want to create entries in certain tables when a new user signs up. For instance, I want to create a userprofile which will then reference their company
This is an old question, but the solution I've found most straightforward is to use the 'raw' argument, passed by load data, and decorate the listener functions, for example:
from functools import wraps
def disable_for_loaddata(signal_handler):
@wraps(signal_handler)
def wrapper(*args, **kwargs):
if kwargs['raw']:
print "Skipping signal for %s %s" % (args, kwargs)
return
signal_handler(*args, **kwargs)
return wrapper
and then
@disable_for_loaddata
def callback_create_profile(sender, **kwargs):
# check if we are creating a new User
...