I have my models in separate files:
models
\
|__init__.py
|event.py
|a_thing.py
|...
In __init__.pyI import each model, and after that I set the signal processing.
For the model EventI need processing post_save.
This is a truncated version __init__.py:
from django.db.models.signals import post_save
from django.dispatch import receiver
from core.models.event import Event
@receiver(post_save, sender = Event)
def event_post_save(sender, dispatch_uid = 'nope', **kwargs):
print kwargs.get('created')
print '------'
Whenever I save Eventthrough the console, the message is post_saveprinted once, but whenever I use the admin interface, it is printed twice. Perhaps this is due to the fact that I import models inside admin.py.
Is there a workaround for this so that I can save Event objects from the admin interface without running twice post_save?
yoshi source