Ticket #15696: serializer-pre-insert-signal.patch

File serializer-pre-insert-signal.patch, 1.4 KB (added by Jonas H., 14 years ago)
  • django/core/management/commands/loaddata.py

    diff --git a/django/core/management/commands/loaddata.py b/django/core/management/commands/loaddata.py
    index 34f3543..6f523c5 100644
    a b from optparse import make_option  
    66
    77from django.conf import settings
    88from django.core import serializers
     9from django.core.serializers.signals import pre_insert
    910from django.core.management.base import BaseCommand
    1011from django.core.management.color import no_style
    1112from django.db import connections, router, transaction, DEFAULT_DB_ALIAS
    class Command(BaseCommand):  
    171172                                    if router.allow_syncdb(using, obj.object.__class__):
    172173                                        loaded_objects_in_fixture += 1
    173174                                        models.add(obj.object.__class__)
     175                                        pre_insert.send(self, instance=obj.object)
    174176                                        obj.save(using=using)
    175177                                loaded_object_count += loaded_objects_in_fixture
    176178                                fixture_object_count += objects_in_fixture
  • new file django/core/serializers/signals.py

    diff --git a/django/core/serializers/signals.py b/django/core/serializers/signals.py
    new file mode 100644
    index 0000000..49e7143
    - +  
     1from django.dispatch import Signal
     2
     3pre_insert = Signal(providing_args=['object'])
Back to Top