I am using post_save
signal to trigger the creation of profile data for User
instance. The problem is if I create a User
object from data migration then the post_save
signal isn't triggering.
However, If I create User
instance via shell or UserCreationForm
, everything seems to be working as normal.
from myapp.models import Profile
. You must useapps.get_model('myapp', 'Profile')
. So you cannot call your function from the migration as well. The reason is simple - if you add some fields to Profile later, and then deploy all this to some new server, you will try to insert values for that fields to the database that does not have them yet. The migrations system are using 'fake', historical versions of your models that represents the state of the model at the time the migration was created. – Viceregal