Ticket #4470: separate_models.9107.diff

File separate_models.9107.diff, 666 bytes (added by Ilya Semenov, 16 years ago)

Revision bump (just in case if some 1.0 newbie suddenly realizes he can't split models.py without copy-pasting app_label to each and every class)

  • django/db/models/base.py

     
    4848            # Figure out the app_label by looking one level up.
    4949            # For 'django.contrib.sites.models', this would be 'sites'.
    5050            model_module = sys.modules[new_class.__module__]
    51             kwargs = {"app_label": model_module.__name__.split('.')[-2]}
     51            module_names = model_module.__name__.split('.')
     52            kwargs = {"app_label": module_names[module_names.index('models')-1]}
    5253        else:
    5354            kwargs = {}
    5455
Back to Top