I’m implementing a simple referral system. I have middleware which sets a session variable identifying the referring user. I have a model which ties a referring user to the referred user. I’m trying to use the post_save signal from the User object to populate this model. How do I access the session object from within the post_save signal handler?
I’m implementing a simple referral system. I have middleware which sets a session variable
Share
There is not way without using a thread specific global variable.
But I’m not sure you need to. For my referral and invite system I just have the user register as normal and after the user has been created, get the referral out of the session. In almost all situations it will still be the same session.
If there is something about your session that prevents that, I would instead add it to the create user form.