Django

Code

Changeset 3279

Show
Ignore:
Timestamp:
07/06/06 08:25:12 (2 years ago)
Author:
mtredinnick
Message:

Fixed another problem where we were creating a class twice via two import
paths. Self-referential relations (e.g. ForeignKey?('self')) were still slipping
through the net. Refs #1796.

Files:

Legend:

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

    r3274 r3279  
    4444            # For 'django.contrib.sites.models', this would be 'sites'. 
    4545            new_class._meta.app_label = model_module.__name__.split('.')[-2] 
     46 
     47        # Bail out early if we have already created this class. 
     48        m = get_model(new_class._meta.app_label, name) 
     49        if m is not None: 
     50            return m 
    4651 
    4752        # Add all attributes to the class.