Django

Code

Changeset 5163

Show
Ignore:
Timestamp:
05/07/07 21:56:18 (1 year ago)
Author:
mtredinnick
Message:

Fixed #4144 -- Only check sys.modules when required during Model class
construction. Patch from Marty Alchin.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/db/models/base.py

    r4893 r5163  
    4343                new_class._meta.parents.extend(base._meta.parents) 
    4444 
    45         model_module = sys.modules[new_class.__module__] 
    4645 
    4746        if getattr(new_class._meta, 'app_label', None) is None: 
    4847            # Figure out the app_label by looking one level up. 
    4948            # For 'django.contrib.sites.models', this would be 'sites'. 
     49            model_module = sys.modules[new_class.__module__] 
    5050            new_class._meta.app_label = model_module.__name__.split('.')[-2] 
    5151