Django

Code

Ticket #1796: management.patch

File management.patch, 0.7 kB (added by curtis.thompson@gmail.com, 4 years ago)

Fix problem when running with the management shell

  • management.py

    old new  
    10501050 
    10511051def run_shell(use_plain=False): 
    10521052    "Runs a Python interactive interpreter. Tries to use IPython, if it's available." 
     1053    # Force loading all the models in the installed apps. Otherwise, we 
     1054    # can get into some weird problems where many_to_many relations fail because 
     1055    # field options differ (perhaps due to permisions): 
     1056    from django.db.models.loading import get_models 
     1057    loaded_models = get_models() 
     1058 
    10531059    try: 
    10541060        if use_plain: 
    10551061            # Don't bother loading IPython, because the user wants plain Python.