Ticket #1658: base.diff

File base.diff, 822 bytes (added by erob@…, 9 years ago)

patch for this issue -- is this working?

  • 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                print new_class._meta.app_label
     51                                                               
    4652
    4753        # Bail out early if we have already created this class.
    4854        m = get_model(new_class._meta.app_label, name)
Back to Top