예제 #1
0
def makemigrations():
    os.system('find . -name \*.pyc -delete')
    if VERSION >= (1, 10):
        call_command('makemigrations', 'money_app', name=MIGRATION_NAME)
    else:
        # In Django 1.8 & 1.9 first argument name clashes with command option.
        Command().execute('money_app', name=MIGRATION_NAME, verbosity=1)
예제 #2
0
    def write_migration_files(self, changes):
        other = MakeMigrations()
        other.verbosity = self.verbosity
        other.interactive = self.interactive
        other.dry_run = self.dry_run
        other.stderr = self.stderr
        other.stdout = self.stdout

        other.write_migration_files(changes)
예제 #3
0
 def write_migration_files(self, changes):
     other = MakeMigrations()
     other.verbosity = self.verbosity
     other.interactive = self.interactive
     other.dry_run = self.dry_run
     other.stderr = self.stderr
     other.stdout = self.stdout
     
     other.write_migration_files(changes)
예제 #4
0
def makemigrations():
    from django.core.management import call_command
    from django.core.management.commands.makemigrations import Command
    from django.db.migrations import questioner

    # We should answer yes for all migrations questioner questions
    questioner.input = lambda x: 'y'

    os.system('find . -name \*.pyc -delete')
    if VERSION >= (1, 11):
        call_command('makemigrations', 'money_app', name=MIGRATION_NAME)
    else:
        # In Django 1.8 first argument name clashes with command option.
        Command().execute('money_app', name=MIGRATION_NAME, verbosity=1)
예제 #5
0
def run_migration_command():
    """
    In Django 1.8 & 1.9 first argument name clashes with command option.
    In Django 1.7 there is no built-in option to name a migration.
    """
    from django.core.management.commands.makemigrations import Command

    if VERSION < (1, 8):

        class Command(Command):
            def write_migration_files(self, changes):
                migration = list(changes.items())[0][1][0]
                migration.name = migration.name.split(
                    '_')[0] + '_' + MIGRATION_NAME
                super(Command, self).write_migration_files(changes)

    Command().execute('money_app', name=MIGRATION_NAME, verbosity=1)
예제 #6
0
ROOT_URLCONF = 'tidbits.urls'


# Our settings for test execution
settings.configure(
    DEBUG=True,
    DATABASES=DATABASES,
    MIDDLEWARE_CLASSES=MIDDLEWARE_CLASSES,
    INSTALLED_APPS=INSTALLED_APPS + ('taggit', 'tidbits',)
)

setup()

from django.core.management.commands.makemigrations import Command

try:
    from StringIO import StringIO
except ImportError:
    from io import StringIO

options = {
    'verbosity': 1
}

out = StringIO()
c = Command()
c.stdout = out
c.handle('tidbits', **options)

print(out.getvalue())
예제 #7
0
#!/usr/bin/env python

import os

from django import setup


if __name__ == "__main__":
    os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.settings'
    setup()

    try:
        from StringIO import StringIO
    except ImportError:
        from io import StringIO

    from django.core.management.commands.makemigrations import Command

    options = {
        'verbosity': 1
    }

    out = StringIO()

    c = Command()
    c.stdout = out
    c.handle('rea', **options)

    print(out.getvalue())