I've got 2 signals being sent at user registration, socialauth_registered and post_save. I'd like for socialauth_registered to precede post_save, as it affects the function that post_save triggers.
Is this possible? (and if it is, how?!)
I'm not sure what exactly is relevant, but I've got:
from django.contrib.auth.models import User
from social_auth.signals import socialauth_registered, pre_update
from django.db.models.signals import post_save
<ALL OF MY MODELS>
def create_user_profile(sender, instance, created, **kwargs):
do some stuff
def create_social_profile(sender, user, response, details, **kwargs):
do other stuff
socialauth_registered.connect(create_social_profile, sender=None)
post_save.connect(create_user_profile, sender=User)
I'm not positive, but I'd say it's doubtful. Kinda more important is that the idea behind signals is that they should be atomic. A signal handler should respond the signal and shouldn't care about other signals. Relying on the order of two unrelated signals (obviously you can rely on the order of pre_save and post_save for example) is not safe in general. So even though I don't have a firm answer on your question, I'd offer the advice that yo should think carefully about the design.