Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When OneToOneField are primary_key, this field in DRF 3.4 will always be null !! #4288

Closed
mrgaolei opened this issue Jul 20, 2016 · 2 comments

Comments

@mrgaolei
Copy link

mrgaolei commented Jul 20, 2016

Model Define:

class Goods(models.Model):
    xxx = models.CharField("xxx", max_length=100)

class GoodsMeta(models.Model):
    goods = models.OneToOneField(Goods, primary_key=True)
    content = models.TextField()

Serializer Define is very simple:

class GoodsMetaSerializer(serializers.ModelSerializer):
    class Meta:
        model = GoodsMeta

In DRF 3.3.3, everything OK, json output:

{["goods":1, "content":"xxx"]}

But in DRF 3.4, the OneToOneField with primary_key always be null:

{["goods":null, "content":"xxx"]}

Why this happened? Is this a bug?

@mrgaolei mrgaolei changed the title When OneToOneField are primary_key, this field in DRF will always be null !! When OneToOneField are primary_key, this field in DRF 3.4 will always be null !! Jul 20, 2016
@tomchristie tomchristie added this to the 3.4.1 Release milestone Jul 26, 2016
@tomchristie
Copy link
Member

Resolved via #4272.

@tomchristie
Copy link
Member

Release incoming.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants