So, I moved the import to views.py (or models.py ), and while it was imported only once, it was called twice.
The problem was that the post_save signal was called when the object was created and also saved. I have no idea why I added a workaround that works now.
created = False #Workaround to signal being emitted twice on create and save if 'created' in kwargs: if kwargs['created']: created=True #If signal is from object creation, return if created: return
Edit:
post_save was called twice because I used .create(...) , which is equivalent to __init__(...) and .save() .
Conclusion
dispatch_uid works and makes single import is still good practice.
Pratik mandrekar
source share