Ticket #23077: 23077.diff

File 23077.diff, 1.5 KB (added by merb, 10 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 b6a1e1d..30e2648 100644
    a b from django.core.management.base import BaseCommand, CommandError  
    1313from django.core.management.color import no_style
    1414from django.db import (connections, router, transaction, DEFAULT_DB_ALIAS,
    1515      IntegrityError, DatabaseError)
     16from django.db.migrations.loader import MigrationLoader
    1617from django.utils import lru_cache
    1718from django.utils.encoding import force_text
    1819from django.utils.functional import cached_property
    class Command(BaseCommand):  
    235236        for app_config in apps.get_app_configs():
    236237            if self.app_label and app_config.label != self.app_label:
    237238                continue
    238             app_dir = os.path.join(app_config.path, 'fixtures')
    239             if os.path.isdir(app_dir):
    240                 dirs.append(app_dir)
     239
     240            # Don't install migrated Apps
     241            loader = MigrationLoader(connections[self.using])
     242            if app_config.label not in loader.migrated_apps:
     243                app_dir = os.path.join(app_config.path, 'fixtures')
     244                if os.path.isdir(app_dir):
     245                    dirs.append(app_dir)
    241246        dirs.extend(list(settings.FIXTURE_DIRS))
    242247        dirs.append('')
    243248        dirs = [upath(os.path.abspath(os.path.realpath(d))) for d in dirs]
Back to Top