      def m2m_reverse_name(self):
          return self.rel.to._meta.pk.column
  
      def contribute_to_class(self, cls, name):
          super(GenericRelation, self).contribute_to_class(cls, name)
  
          # Save a reference to which model this class is on for future use
          self.model = cls
  
 
</s> remove from models import Person, Group, Membership, UserMembership
 </s> add from models import (Person, Group, Membership, UserMembership,
                    Car, Driver, CarDriver) </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
    def m2m_target_field_name(self):
        return self.model._meta.pk.name

    def m2m_reverse_target_field_name(self):
        return self.rel.to._meta.pk.name

      def m2m_reverse_name(self):
          return self.rel.to._meta.pk.column
  
    def m2m_target_field_name(self):
        return self.model._meta.pk.name

    def m2m_reverse_target_field_name(self):
        return self.rel.to._meta.pk.name

      def contribute_to_class(self, cls, name):
          super(GenericRelation, self).contribute_to_class(cls, name)
  
          # Save a reference to which model this class is on for future use
          self.model = cls
  
keep keep add keep 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 
django/contrib/contenttypes/generic.py