Ticket #4470: separates_models.diff

File separates_models.diff, 743 bytes (added by Sidi Mohamed EL AATIFI <elaatifi@…>, 17 years ago)
  • db/models/base.py

     
    4747            # Figure out the app_label by looking one level up.
    4848            # For 'django.contrib.sites.models', this would be 'sites'.
    4949            model_module = sys.modules[new_class.__module__]
    50             new_class._meta.app_label = model_module.__name__.split('.')[-2]
     50            module_name = model_module.__name__.split('.')
     51            new_class._meta.app_label = module_name[module_name.index('models')-1]
    5152
    5253        # Bail out early if we have already created this class.
    5354        m = get_model(new_class._meta.app_label, name, False)
Back to Top