{"action":"created","issue":{"url":"https://api.github.com/repos/tomchristie/django-rest-framework/issues/2114","repository_url":"https://api.github.com/repos/tomchristie/django-rest-framework","labels_url":"https://api.github.com/repos/tomchristie/django-rest-framework/issues/2114/labels{/name}","comments_url":"https://api.github.com/repos/tomchristie/django-rest-framework/issues/2114/comments","events_url":"https://api.github.com/repos/tomchristie/django-rest-framework/issues/2114/events","html_url":"https://github.com/tomchristie/django-rest-framework/issues/2114","id":49793493,"number":2114,"title":"django-rest-framework: serializer from DATA don't update model ID","user":{"login":"StErMi","id":146166,"avatar_url":"https://avatars.githubusercontent.com/u/146166?v=3","gravatar_id":"","url":"https://api.github.com/users/StErMi","html_url":"https://github.com/StErMi","followers_url":"https://api.github.com/users/StErMi/followers","following_url":"https://api.github.com/users/StErMi/following{/other_user}","gists_url":"https://api.github.com/users/StErMi/gists{/gist_id}","starred_url":"https://api.github.com/users/StErMi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StErMi/subscriptions","organizations_url":"https://api.github.com/users/StErMi/orgs","repos_url":"https://api.github.com/users/StErMi/repos","events_url":"https://api.github.com/users/StErMi/events{/privacy}","received_events_url":"https://api.github.com/users/StErMi/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2014-11-22T14:53:33Z","updated_at":"2016-05-09T19:46:54Z","closed_at":"2014-11-22T20:59:43Z","body":"I've also posted on stackoverflow to gather help faster: http://stackoverflow.com/questions/27076918/django-rest-framework-serializer-from-data-dont-update-model-id\r\n\r\nI've a simple serializer like this:\r\n```python\r\n    class CategoryCreationSerializer(serializers.ModelSerializer):\r\n    \r\n        class Meta:\r\n            model = Category\r\n```\r\nCategory has an id field (Django primary key) and I don't get why the Serializer is not updating it.\r\n\r\nScenario: I've a BlogPost with a given category. I'm updating the BlogPost with a different Category (already created on the database). So the POST request will have all the BlogPost information with the new Category JSON object with the updated id:\r\n```json\r\n    {\r\n        \"id\": 1,\r\n        \"title\": \"My first blog post\",\r\n        \"category\": {\r\n            \"id\": 3,\r\n            \"name\": \"Techology\"\r\n        }\r\n    }\r\n```\r\nThe problem is that when I'm doing this:\r\n\r\n```python\r\n    category_data = data.get('category')\r\n        if category_data is not None:\r\n            category_serializer = CategoryCreationSerializer(data=category_data)\r\n            if category_serializer.is_valid():\r\n                blog_post.category = category_serializer.object\r\n```\r\n\r\ninside category title will be updated but the id field will be NONE.\r\nCan you explain me why? \r\n\r\nCheers, Emanuele."},"comment":{"url":"https://api.github.com/repos/tomchristie/django-rest-framework/issues/comments/217968807","html_url":"https://github.com/tomchristie/django-rest-framework/issues/2114#issuecomment-217968807","issue_url":"https://api.github.com/repos/tomchristie/django-rest-framework/issues/2114","id":217968807,"user":{"login":"xordoquy","id":2340654,"avatar_url":"https://avatars.githubusercontent.com/u/2340654?v=3","gravatar_id":"","url":"https://api.github.com/users/xordoquy","html_url":"https://github.com/xordoquy","followers_url":"https://api.github.com/users/xordoquy/followers","following_url":"https://api.github.com/users/xordoquy/following{/other_user}","gists_url":"https://api.github.com/users/xordoquy/gists{/gist_id}","starred_url":"https://api.github.com/users/xordoquy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xordoquy/subscriptions","organizations_url":"https://api.github.com/users/xordoquy/orgs","repos_url":"https://api.github.com/users/xordoquy/repos","events_url":"https://api.github.com/users/xordoquy/events{/privacy}","received_events_url":"https://api.github.com/users/xordoquy/received_events","type":"User","site_admin":false},"created_at":"2016-05-09T19:46:54Z","updated_at":"2016-05-09T19:46:54Z","body":"@aj07mm, the [discussion group](https://groups.google.com/forum/#!forum/django-rest-framework) is the best place to take this discussion and other usage questions. Thanks!"}}