mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
Fixed #4288 -- Modified serializers to pay attention to the to_field attribute on ForeignKeys. Thanks to Sandro Dentella for the report and the helpful test case.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5232 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -116,6 +116,16 @@ class FKSelfData(models.Model):
|
||||
class M2MSelfData(models.Model):
|
||||
data = models.ManyToManyField('self', null=True, symmetrical=False)
|
||||
|
||||
|
||||
class UniqueAnchor(models.Model):
|
||||
"""This is a model that can be used as
|
||||
something for other models to point at"""
|
||||
|
||||
data = models.CharField(unique=True, maxlength=30)
|
||||
|
||||
class FKDataToField(models.Model):
|
||||
data = models.ForeignKey(UniqueAnchor, null=True, to_field='data')
|
||||
|
||||
# The following test classes are for validating the
|
||||
# deserialization of objects that use a user-defined
|
||||
# field as the primary key.
|
||||
|
||||
Reference in New Issue
Block a user