mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-23 10:03:57 +03:00
Make OneToOneSource.target nullable
This commit is contained in:
parent
0a92e1ad8c
commit
abe655e061
|
@ -10,7 +10,8 @@ class OneToOneTarget(models.Model):
|
||||||
|
|
||||||
class OneToOneSource(models.Model):
|
class OneToOneSource(models.Model):
|
||||||
name = models.CharField(max_length=100)
|
name = models.CharField(max_length=100)
|
||||||
target = models.OneToOneField(OneToOneTarget, related_name='source')
|
target = models.OneToOneField(OneToOneTarget, related_name='source',
|
||||||
|
null=True, blank=True)
|
||||||
|
|
||||||
|
|
||||||
class OneToManyTarget(models.Model):
|
class OneToManyTarget(models.Model):
|
||||||
|
@ -21,7 +22,7 @@ class OneToManySource(models.Model):
|
||||||
name = models.CharField(max_length=100)
|
name = models.CharField(max_length=100)
|
||||||
target = models.ForeignKey(OneToManyTarget, related_name='sources')
|
target = models.ForeignKey(OneToManyTarget, related_name='sources')
|
||||||
|
|
||||||
|
|
||||||
class ReverseNestedOneToOneTests(TestCase):
|
class ReverseNestedOneToOneTests(TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
class OneToOneSourceSerializer(serializers.ModelSerializer):
|
class OneToOneSourceSerializer(serializers.ModelSerializer):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user