Ticket #4470: separate_models.7835.diff

File separate_models.7835.diff, 663 bytes (added by Ilya Semenov, 16 years ago)

New patch which works after [7777] models refactoring

  • django/db/models/base.py

     
    5656            # Figure out the app_label by looking one level up.
    5757            # For 'django.contrib.sites.models', this would be 'sites'.
    5858            model_module = sys.modules[new_class.__module__]
    59             kwargs = {"app_label": model_module.__name__.split('.')[-2]}
     59            module_name = model_module.__name__.split('.')
     60            kwargs = {"app_label": module_name[module_name.index('models')-1]}
    6061        else:
    6162            kwargs = {}
    6263
Back to Top