  from django.core import management
  from django.contrib.auth.models import User
  from django.test import TestCase
  
  from models import Person, Group, Membership, UserMembership
  
  
  class M2MThroughTestCase(TestCase):
      def test_everything(self):
          bob = Person.objects.create(name="Bob")
 
</s> remove                         from_col1 = opts.pk.column
 </s> add                         from_col1 = opts.get_field_by_name(
                            field.m2m_reverse_target_field_name())[0].column </s> remove                         from_col1 = opts.pk.column
 </s> add                         from_col1 = opts.get_field_by_name(
                            field.m2m_target_field_name())[0].column </s> remove                         to_col2 = opts.pk.column
 </s> add                         to_col2 = opts.get_field_by_name(
                            field.m2m_target_field_name())[0].column
from models import (Person, Group, Membership, UserMembership,
                    Car, Driver, CarDriver)
  from django.core import management
  from django.contrib.auth.models import User
  from django.test import TestCase
  
from models import (Person, Group, Membership, UserMembership,
                    Car, Driver, CarDriver)
  
  
  class M2MThroughTestCase(TestCase):
      def test_everything(self):
          bob = Person.objects.create(name="Bob")
keep keep keep keep replace keep keep keep keep keep
 Fixed #15161 - Corrected handling of ManyToManyField with through table using to_field on its ForeignKeys. Thanks to adehnert for the report.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@15330 bcc190cf-cafb-0310-a4f2-bffc1f526a37 
tests/regressiontests/m2m_through_regress/tests.py