Ticket #2232: recursive-import-fix.diff

File recursive-import-fix.diff, 1.3 KB (added by Malcolm Tredinnick, 18 years ago)

Partial fix

  • django/db/models/base.py

     
    99from django.db.models.options import Options, AdminOptions
    1010from django.db import connection, backend, transaction
    1111from django.db.models import signals
    12 from django.db.models.loading import register_models
     12from django.db.models.loading import register_models, get_model
    1313from django.dispatch import dispatcher
    1414from django.utils.datastructures import SortedDict
    1515from django.utils.functional import curry
     
    6060        new_class._prepare()
    6161
    6262        register_models(new_class._meta.app_label, new_class)
    63         return new_class
     63        return get_model(new_class._meta.app_label, name)
    6464
    6565class Model(object):
    6666    __metaclass__ = ModelBase
  • django/db/models/loading.py

     
    7373    Returns the model matching the given app_label and case-insensitive model_name.
    7474    Returns None if no model is found.
    7575    """
    76     get_apps() # Run get_apps() to populate the _app_list cache. Slightly hackish.
    7776    try:
    7877        model_dict = _app_models[app_label]
    7978    except KeyError:
Back to Top