﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
3389	Allow m2m sets to be assigned by primary key value	Russell Keith-Magee	Adrian Holovaty	"At present, m2m relations must be specified using a list of object instances:
{{{
    john = Author(...)
    john.save()
    fred = Author(...)
    fred.save()
    Article.authors = [john, fred]
}}}

This proposal (and patch) would allow m2m relations be specified using primary key values in place of the object instance:
{{{
    Article.authors = [john.id, fred.id]
    # or, if you know the pk values to begin with...
    Article.authors = [4,7]
}}}

The reason for this is twofold:
  1. For parity with the ability to set m2o related objects by primary key (using Article.author_id = 3)
  2. To simplify deserialization, removing the need for a query to find related objects while deserializing m2m sets.
"		closed	Database layer (models, ORM)	dev		fixed	m2m primary key		Design decision needed	1	1	0	0	0	0
