Ticket #7857: testshell.diff

File testshell.diff, 1005 bytes (added by Mark Barrett, 13 years ago)
  • django/core/management/commands/testshell.py

     
     1import os
     2from django.core.management import call_command
     3from django.core.management.base import BaseCommand
     4from optparse import make_option
     5
     6class Command(BaseCommand):
     7        option_list = BaseCommand.option_list + (
     8                make_option('--plain', action='store_true', dest='plain',
     9                        help='Tells Django to use plain Python, not IPython.'),
     10        )
     11        help = "Runs a Python interactive interpreter. Tries to use IPython, if it's available."
     12        shells = ['ipython', 'bpython']
     13        requires_model_validation = False
     14
     15        def handle(self, *args, **options):
     16                print 'Using test database'
     17                from django.db import connection
     18                connection.creation.create_test_db()
     19
     20                use_plain = options.get('plain', False)
     21
     22                call_command('shell', plain=use_plain)
Back to Top