From 5119dc2f5e15a1da4d8ca426b170794d213d991a Mon Sep 17 00:00:00 2001 From: Jean-Baptiste <bleme@pm.me> Date: Thu, 6 Jun 2019 09:32:44 +0200 Subject: [PATCH] comment: nested update can't work when depth=0 --- djangoldp/tests/models.py | 5 ++++- djangoldp/tests/tests_update.py | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/djangoldp/tests/models.py b/djangoldp/tests/models.py index 95dcd8fd..899a1232 100644 --- a/djangoldp/tests/models.py +++ b/djangoldp/tests/models.py @@ -36,6 +36,9 @@ class UserProfile(Model): description = models.CharField(max_length=255, blank=True, null=True) user = models.OneToOneField(settings.AUTH_USER_MODEL) + class Meta: + depth = 1 + class Message(models.Model): text = models.CharField(max_length=255, blank=True, null=True) @@ -86,4 +89,4 @@ class Post(Model): auto_author = 'author' -get_user_model()._meta.serializer_fields = ['@id', 'username', 'first_name', 'last_name', 'email', 'userprofile'] +get_user_model()._meta.serializer_fields = ['@id', 'username', 'first_name', 'last_name', 'email', 'userprofile'] \ No newline at end of file diff --git a/djangoldp/tests/tests_update.py b/djangoldp/tests/tests_update.py index 1e3f22d2..5ba048c2 100644 --- a/djangoldp/tests/tests_update.py +++ b/djangoldp/tests/tests_update.py @@ -272,7 +272,11 @@ class Update(TestCase): self.assertEquals(response.data['content'], "post content") self.assertIn('location', response._headers) + def test_create_sub_object_in_existing_object_with_reverse_relation(self): + """ + Doesn't work with depth = 0 on UserProfile Model. Should it be ? + """ user = User.objects.create(username="alex", password="test") body = [ { -- GitLab