django/django — pull request #1585 by sheats (2013-09-07 00:41:49+00:00)
Title: Fixed #20836: to_field lost when adding via raw_id_fields

Added a selenium test that demonstrated the problem.

Started from this pull request https://github.com/django/django/pull/1417 and then fixed a couple more areas.