You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
The text was updated successfully, but these errors were encountered:
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
Model Define:
Serializer Define is very simple:
In DRF 3.3.3, everything OK, json output:
But in DRF 3.4, the OneToOneField with primary_key always be null:
Why this happened? Is this a bug?
The text was updated successfully, but these errors were encountered: