diff --git a/django/django/core/management/commands/shell.py b/django/django/core/management/commands/shell.py
index 9616902..223b9ef 100644
a
|
b
|
class Command(NoArgsCommand):
|
6 | 6 | option_list = NoArgsCommand.option_list + ( |
7 | 7 | make_option('--plain', action='store_true', dest='plain', |
8 | 8 | help='Tells Django to use plain Python, not IPython.'), |
| 9 | make_option('--gui', action='store_true', dest='gui', |
| 10 | help='Tells Django to use IPythonX, not IPython.'), |
9 | 11 | ) |
10 | 12 | help = "Runs a Python interactive interpreter. Tries to use IPython, if it's available." |
11 | 13 | |
… |
… |
class Command(NoArgsCommand):
|
18 | 20 | loaded_models = get_models() |
19 | 21 | |
20 | 22 | use_plain = options.get('plain', False) |
| 23 | use_gui = options.get('gui', False) |
21 | 24 | |
22 | 25 | try: |
23 | 26 | if use_plain: |
24 | 27 | # Don't bother loading IPython, because the user wants plain Python. |
25 | 28 | raise ImportError |
| 29 | |
| 30 | if use_gui: |
| 31 | try: |
| 32 | from IPython.frontend.wx.ipythonx import IPythonX, wx |
| 33 | |
| 34 | app = wx.PySimpleApp() |
| 35 | |
| 36 | frame = IPythonX(None, wx.ID_ANY, 'IPythonX') |
| 37 | frame.shell.SetFocus() |
| 38 | frame.shell.app = app |
| 39 | frame.SetSize((680, 460)) |
| 40 | |
| 41 | app.MainLoop() |
| 42 | |
| 43 | return |
| 44 | except ImportError: |
| 45 | pass |
| 46 | |
26 | 47 | import IPython |
27 | 48 | # Explicitly pass an empty list as arguments, because otherwise IPython |
28 | 49 | # would use sys.argv from this script. |
… |
… |
class Command(NoArgsCommand):
|
35 | 56 | # See ticket 5082. |
36 | 57 | imported_objects = {} |
37 | 58 | try: # Try activating rlcompleter, because it's handy. |
38 | | import readline |
| 59 | import readline, rlcompleter |
39 | 60 | except ImportError: |
40 | 61 | pass |
41 | 62 | else: |
42 | 63 | # We don't have to wrap the following import in a 'try', because |
43 | 64 | # we already know 'readline' was imported successfully. |
44 | | import rlcompleter |
45 | 65 | readline.set_completer(rlcompleter.Completer(imported_objects).complete) |
46 | 66 | readline.parse_and_bind("tab:complete") |
47 | 67 | |