Ticket #6511: ignore_initial.diff

File ignore_initial.diff, 1.7 KB (added by jkocherhans, 17 years ago)

No docs yet.

  • django/core/management/commands/syncdb.py

    diff --git a/django/core/management/commands/syncdb.py b/django/core/management/commands/syncdb.py
    index 0f21130..c2e5f41 100644
    a b class Command(NoArgsCommand):  
    1515            help='Verbosity level; 0=minimal output, 1=normal output, 2=all output'),
    1616        make_option('--noinput', action='store_false', dest='interactive', default=True,
    1717            help='Tells Django to NOT prompt the user for input of any kind.'),
     18        make_option('--ignore-initial', action='store_true', dest='ignore_initial', default=False,
     19            help='Tells Django NOT load the initial_data fixture.'),
    1820    )
    1921    help = "Create the database tables for all apps in INSTALLED_APPS whose tables haven't already been created."
    2022
    class Command(NoArgsCommand):  
    2527
    2628        verbosity = int(options.get('verbosity', 1))
    2729        interactive = options.get('interactive')
     30        ignore_initial = options.get('ignore_initial')
    2831
    2932        self.style = no_style()
    3033
    class Command(NoArgsCommand):  
    132135                            transaction.rollback_unless_managed()
    133136                        else:
    134137                            transaction.commit_unless_managed()
    135 
    136         # Install the 'initial_data' fixture, using format discovery
    137         from django.core.management import call_command
    138         call_command('loaddata', 'initial_data', verbosity=verbosity)
     138        if not ignore_initial:
     139            # Install the 'initial_data' fixture, using format discovery
     140            from django.core.management import call_command
     141            call_command('loaddata', 'initial_data', verbosity=verbosity)
Back to Top