Ticket #11226: m2m_name_clashes.diff
File m2m_name_clashes.diff, 1.4 KB (added by , 15 years ago) |
---|
-
django/db/models/fields/related.py
816 816 self._m2m_column_name_cache = f.column 817 817 break 818 818 # If this is an m2m relation to self, avoid the inevitable name clash 819 elif related.model == related.parent_model:819 elif related.model._meta.object_name == related.parent_model._meta.object_name: 820 820 self._m2m_column_name_cache = 'from_' + related.model._meta.object_name.lower() + '_id' 821 821 else: 822 822 self._m2m_column_name_cache = related.model._meta.object_name.lower() + '_id' … … 847 847 self._m2m_reverse_name_cache = f.column 848 848 break 849 849 # If this is an m2m relation to self, avoid the inevitable name clash 850 elif related.model == related.parent_model:850 elif related.model._meta.object_name == related.parent_model._meta.object_name: 851 851 self._m2m_reverse_name_cache = 'to_' + related.parent_model._meta.object_name.lower() + '_id' 852 852 else: 853 853 self._m2m_reverse_name_cache = related.parent_model._meta.object_name.lower() + '_id'