Ticket #1686: base.diff

File base.diff, 766 bytes (added by erob@…, 18 years ago)

partial work-around: works with unittest and django.db.models.Model

  • base.py

     
    4242        if getattr(new_class._meta, 'app_label', None) is None:
    4343            # Figure out the app_label by looking one level up.
    4444            # For 'django.contrib.sites.models', this would be 'sites'.
    45             new_class._meta.app_label = model_module.__name__.split('.')[-2]
     45            try:
     46                new_class._meta.app_label = model_module.__name__.split('.')[-2]
     47            except IndexError, e:
     48                cwd = os.getcwd()
     49                new_class._meta.app_label = os.path.basename(cwd)
     50                                                               
    4651
    4752        # Bail out early if we have already created this class.
    4853        m = get_model(new_class._meta.app_label, name)
Back to Top