I have delusions that I've seen it in some piece of code and it's some variable's state. Example usage would be in signal handlers.
Asked
Active
Viewed 265 times
2 Answers
1
I haven't checked it out yet, but from this discussion, http://code.djangoproject.com/ticket/8399 it seems that loaddata sends out post_save signals.

Izz ad-Din Ruhulessin
- 5,955
- 7
- 28
- 28
-
Dunno about the signals but, looks like the check for module named `loaddata` in `inspect.stack()` used there is not maybe the most efficient but works fine. Thanks! – trybik Nov 08 '10 at 16:35
1
(8 years later) stumbled upon own question, and the example would be (tested in >=1.11):
from django.db.models.signals import pre_save
from django.dispatch import receiver
@receiver(pre_save) # `post_save` also works
def callback_on_loaddata(sender, **kwargs):
# 'raw' indicates that loaddata cmd was issued
if kwargs.get('created', True) and kwargs.get('raw', False):
# mark on-going loaddata, call kwargs.get('instance').clean() etc.
...

trybik
- 482
- 6
- 16