This project demonstrates the difference in SQL generation for ManyToManyFields between Django 1.1 and current (14 Jan 2010) trunk. 

Consider the following three apps and models:

AppA/models.py:

class ModelA(models.Model):
    name = models.CharField(max_length=1024, default='', blank=True)

AppB/models.py:

class ModelB(models.Model):
    name = models.CharField(max_length=1024, default='', blank=True)
    ma = models.ManyToManyField('AppA.ModelA', blank=True, null=True, related_name='mb')
    mc = models.ManyToManyField('AppC.ModelC', blank=True, null=True, related_name='mc')

AppC/models.py:

class ModelC(models.Model):
    name = models.CharField(max_length=1024, default='', blank=True)

The SQL generated for AppB is different for Django 1.1 and 1.2/trunk. This breaks backwards compatibility. 

See the following files generated via './manage.py sql AppB' for Djangao versions 1.1 and trunk:
- AppB-1.1.sql
- AppB-1.2.sql

It seems that in some cases 1.2 names the m2m column 'app.model_id' whereas 1.1 uses 'model_id' only - i.e. no 'app.'

This only seems to happen when there are more that one m2m fields in a model. Tested with postgresql.

Django 1.1

CREATE TABLE "AppB_modelb_mc" (
    "id" serial NOT NULL PRIMARY KEY,
    "modelb_id" integer NOT NULL REFERENCES "AppB_modelb" ("id") DEFERRABLE INITIALLY DEFERRED,
    "modelc_id" integer NOT NULL REFERENCES "AppC_modelc" ("id") DEFERRABLE INITIALLY DEFERRED,
    UNIQUE ("modelb_id", "modelc_id")
);

Django 1.2 

CREATE TABLE "AppB_modelb_mc" (
    "id" serial NOT NULL PRIMARY KEY,
    "modelb_id" integer NOT NULL,
    "appc.modelc_id" integer NOT NULL,
    UNIQUE ("modelb_id", "appc.modelc_id")
);


