mirror of
				https://github.com/django/django.git
				synced 2025-10-31 01:25:32 +00:00 
			
		
		
		
	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.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3279 bcc190cf-cafb-0310-a4f2-bffc1f526a37
			
			
This commit is contained in:
		| @@ -44,6 +44,11 @@ class ModelBase(type): | ||||
|             # For 'django.contrib.sites.models', this would be 'sites'. | ||||
|             new_class._meta.app_label = model_module.__name__.split('.')[-2] | ||||
|  | ||||
|         # Bail out early if we have already created this class. | ||||
|         m = get_model(new_class._meta.app_label, name) | ||||
|         if m is not None: | ||||
|             return m | ||||
|  | ||||
|         # Add all attributes to the class. | ||||
|         for obj_name, obj in attrs.items(): | ||||
|             new_class.add_to_class(obj_name, obj) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user