{"action":"created","comment":{"url":"https://api.github.com/repos/OpenSlides/OpenSlides/pulls/comments/30128489","id":30128489,"diff_hunk":"@@ -134,40 +123,120 @@ class Meta:\n             'reason',)\n \n \n+class WorkflowField(IntegerField):\n+    \"\"\"\n+    Field to handle motion workflow pk.\n+    \"\"\"\n+    def __init__(self, **kwargs):\n+        \"\"\"\n+        Initiates the field. Sets minimum value to 1 and makes this field not\n+        required.\n+        \"\"\"\n+        kwargs['required'] = False\n+        kwargs['min_value'] = 1\n+        super().__init__(**kwargs)\n+\n+    def run_validation(self, *arg, **kwargs):\n+        \"\"\"\n+        Ensures that the workflow with the given id exists.\n+        \"\"\"\n+        value = super().run_validation(*arg, **kwargs)\n+        if not Workflow.objects.filter(pk=value).exists():\n+            raise ValidationError(_('Workflow %(pk)d does not exist.') % {'pk': value})\n+        return value\n+\n+\n class MotionSerializer(ModelSerializer):\n     \"\"\"\n     Serializer for motion.models.Motion objects.\n     \"\"\"\n-    versions = MotionVersionSerializer(many=True, read_only=True)\n     active_version = PrimaryKeyRelatedField(read_only=True)\n-    submitter = MotionSubmitterSerializer(many=True, read_only=True)\n-    supporter = MotionSupporterSerializer(many=True, read_only=True)\n-    state = StateSerializer(read_only=True)\n-    workflow = SerializerMethodField()\n-    polls = MotionPollSerializer(many=True, read_only=True)\n     log_messages = MotionLogSerializer(many=True, read_only=True)\n+    polls = MotionPollSerializer(many=True, read_only=True)\n+    reason = CharField(allow_blank=True, required=False, write_only=True)\n+    state = StateSerializer(read_only=True)\n+    text = CharField(write_only=True)\n+    title = CharField(max_length=255, write_only=True)\n+    versions = MotionVersionSerializer(many=True, read_only=True)\n+    workflow = WorkflowField()\n \n     class Meta:\n         model = Motion\n         fields = (\n             'id',\n             'identifier',\n-            'identifier_number',\n-            'parent',\n-            'category',\n-            'tags',\n+            'title',\n+            'text',\n+            'reason',\n             'versions',\n             'active_version',\n-            'submitter',\n-            'supporter',\n+            'parent',\n+            'category',\n+            'submitters',\n+            'supporters',\n             'state',\n             'workflow',\n+            'tags',\n             'attachments',\n             'polls',\n             'log_messages',)\n+        read_only_fields = ('parent',)  # Some other fields are also read_only. See definitions above.\n \n-    def get_workflow(self, motion):\n+    def create(self, validated_data):","path":"openslides/motions/serializers.py","position":125,"original_position":125,"commit_id":"08c5eda8769240fad7c7b2e73986a04731246710","original_commit_id":"08c5eda8769240fad7c7b2e73986a04731246710","user":{"login":"ostcar","id":977937,"avatar_url":"https://avatars.githubusercontent.com/u/977937?v=3","gravatar_id":"","url":"https://api.github.com/users/ostcar","html_url":"https://github.com/ostcar","followers_url":"https://api.github.com/users/ostcar/followers","following_url":"https://api.github.com/users/ostcar/following{/other_user}","gists_url":"https://api.github.com/users/ostcar/gists{/gist_id}","starred_url":"https://api.github.com/users/ostcar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ostcar/subscriptions","organizations_url":"https://api.github.com/users/ostcar/orgs","repos_url":"https://api.github.com/users/ostcar/repos","events_url":"https://api.github.com/users/ostcar/events{/privacy}","received_events_url":"https://api.github.com/users/ostcar/received_events","type":"User","site_admin":false},"body":"Pleas use transaction.atomic() as function decorator ","created_at":"2015-05-12T12:33:03Z","updated_at":"2015-05-12T12:33:03Z","html_url":"https://github.com/OpenSlides/OpenSlides/pull/1517#discussion_r30128489","pull_request_url":"https://api.github.com/repos/OpenSlides/OpenSlides/pulls/1517","_links":{"self":{"href":"https://api.github.com/repos/OpenSlides/OpenSlides/pulls/comments/30128489"},"html":{"href":"https://github.com/OpenSlides/OpenSlides/pull/1517#discussion_r30128489"},"pull_request":{"href":"https://api.github.com/repos/OpenSlides/OpenSlides/pulls/1517"}}},"pull_request":{"url":"https://api.github.com/repos/OpenSlides/OpenSlides/pulls/1517","id":34481083,"html_url":"https://github.com/OpenSlides/OpenSlides/pull/1517","diff_url":"https://github.com/OpenSlides/OpenSlides/pull/1517.diff","patch_url":"https://github.com/OpenSlides/OpenSlides/pull/1517.patch","issue_url":"https://api.github.com/repos/OpenSlides/OpenSlides/issues/1517","number":1517,"state":"open","locked":false,"title":"Added motion views.","user":{"login":"normanjaeckel","id":2073844,"avatar_url":"https://avatars.githubusercontent.com/u/2073844?v=3","gravatar_id":"","url":"https://api.github.com/users/normanjaeckel","html_url":"https://github.com/normanjaeckel","followers_url":"https://api.github.com/users/normanjaeckel/followers","following_url":"https://api.github.com/users/normanjaeckel/following{/other_user}","gists_url":"https://api.github.com/users/normanjaeckel/gists{/gist_id}","starred_url":"https://api.github.com/users/normanjaeckel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/normanjaeckel/subscriptions","organizations_url":"https://api.github.com/users/normanjaeckel/orgs","repos_url":"https://api.github.com/users/normanjaeckel/repos","events_url":"https://api.github.com/users/normanjaeckel/events{/privacy}","received_events_url":"https://api.github.com/users/normanjaeckel/received_events","type":"User","site_admin":false},"body":"Please have a first look so I can also implement motion update view in this way.","created_at":"2015-04-30T17:14:48Z","updated_at":"2015-05-12T12:33:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"343603310c6f84968a81ed53ac7d12ebfc5d9c5c","assignee":{"login":"normanjaeckel","id":2073844,"avatar_url":"https://avatars.githubusercontent.com/u/2073844?v=3","gravatar_id":"","url":"https://api.github.com/users/normanjaeckel","html_url":"https://github.com/normanjaeckel","followers_url":"https://api.github.com/users/normanjaeckel/followers","following_url":"https://api.github.com/users/normanjaeckel/following{/other_user}","gists_url":"https://api.github.com/users/normanjaeckel/gists{/gist_id}","starred_url":"https://api.github.com/users/normanjaeckel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/normanjaeckel/subscriptions","organizations_url":"https://api.github.com/users/normanjaeckel/orgs","repos_url":"https://api.github.com/users/normanjaeckel/repos","events_url":"https://api.github.com/users/normanjaeckel/events{/privacy}","received_events_url":"https://api.github.com/users/normanjaeckel/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/OpenSlides/OpenSlides/milestones/17","html_url":"https://github.com/OpenSlides/OpenSlides/milestones/2.0","labels_url":"https://api.github.com/repos/OpenSlides/OpenSlides/milestones/17/labels","id":720870,"number":17,"title":"2.0","description":"We think we are ready not before May 2015.","creator":{"login":"normanjaeckel","id":2073844,"avatar_url":"https://avatars.githubusercontent.com/u/2073844?v=3","gravatar_id":"","url":"https://api.github.com/users/normanjaeckel","html_url":"https://github.com/normanjaeckel","followers_url":"https://api.github.com/users/normanjaeckel/followers","following_url":"https://api.github.com/users/normanjaeckel/following{/other_user}","gists_url":"https://api.github.com/users/normanjaeckel/gists{/gist_id}","starred_url":"https://api.github.com/users/normanjaeckel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/normanjaeckel/subscriptions","organizations_url":"https://api.github.com/users/normanjaeckel/orgs","repos_url":"https://api.github.com/users/normanjaeckel/repos","events_url":"https://api.github.com/users/normanjaeckel/events{/privacy}","received_events_url":"https://api.github.com/users/normanjaeckel/received_events","type":"User","site_admin":false},"open_issues":58,"closed_issues":102,"state":"open","created_at":"2014-07-14T20:36:14Z","updated_at":"2015-05-12T12:12:10Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/OpenSlides/OpenSlides/pulls/1517/commits","review_comments_url":"https://api.github.com/repos/OpenSlides/OpenSlides/pulls/1517/comments","review_comment_url":"https://api.github.com/repos/OpenSlides/OpenSlides/pulls/comments{/number}","comments_url":"https://api.github.com/repos/OpenSlides/OpenSlides/issues/1517/comments","statuses_url":"https://api.github.com/repos/OpenSlides/OpenSlides/statuses/08c5eda8769240fad7c7b2e73986a04731246710","head":{"label":"normanjaeckel:MotionRESTAPIChanges","ref":"MotionRESTAPIChanges","sha":"08c5eda8769240fad7c7b2e73986a04731246710","user":{"login":"normanjaeckel","id":2073844,"avatar_url":"https://avatars.githubusercontent.com/u/2073844?v=3","gravatar_id":"","url":"https://api.github.com/users/normanjaeckel","html_url":"https://github.com/normanjaeckel","followers_url":"https://api.github.com/users/normanjaeckel/followers","following_url":"https://api.github.com/users/normanjaeckel/following{/other_user}","gists_url":"https://api.github.com/users/normanjaeckel/gists{/gist_id}","starred_url":"https://api.github.com/users/normanjaeckel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/normanjaeckel/subscriptions","organizations_url":"https://api.github.com/users/normanjaeckel/orgs","repos_url":"https://api.github.com/users/normanjaeckel/repos","events_url":"https://api.github.com/users/normanjaeckel/events{/privacy}","received_events_url":"https://api.github.com/users/normanjaeckel/received_events","type":"User","site_admin":false},"repo":{"id":5361084,"name":"OpenSlides","full_name":"normanjaeckel/OpenSlides","owner":{"login":"normanjaeckel","id":2073844,"avatar_url":"https://avatars.githubusercontent.com/u/2073844?v=3","gravatar_id":"","url":"https://api.github.com/users/normanjaeckel","html_url":"https://github.com/normanjaeckel","followers_url":"https://api.github.com/users/normanjaeckel/followers","following_url":"https://api.github.com/users/normanjaeckel/following{/other_user}","gists_url":"https://api.github.com/users/normanjaeckel/gists{/gist_id}","starred_url":"https://api.github.com/users/normanjaeckel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/normanjaeckel/subscriptions","organizations_url":"https://api.github.com/users/normanjaeckel/orgs","repos_url":"https://api.github.com/users/normanjaeckel/repos","events_url":"https://api.github.com/users/normanjaeckel/events{/privacy}","received_events_url":"https://api.github.com/users/normanjaeckel/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/normanjaeckel/OpenSlides","description":"","fork":true,"url":"https://api.github.com/repos/normanjaeckel/OpenSlides","forks_url":"https://api.github.com/repos/normanjaeckel/OpenSlides/forks","keys_url":"https://api.github.com/repos/normanjaeckel/OpenSlides/keys{/key_id}","collaborators_url":"https://api.github.com/repos/normanjaeckel/OpenSlides/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/normanjaeckel/OpenSlides/teams","hooks_url":"https://api.github.com/repos/normanjaeckel/OpenSlides/hooks","issue_events_url":"https://api.github.com/repos/normanjaeckel/OpenSlides/issues/events{/number}","events_url":"https://api.github.com/repos/normanjaeckel/OpenSlides/events","assignees_url":"https://api.github.com/repos/normanjaeckel/OpenSlides/assignees{/user}","branches_url":"https://api.github.com/repos/normanjaeckel/OpenSlides/branches{/branch}","tags_url":"https://api.github.com/repos/normanjaeckel/OpenSlides/tags","blobs_url":"https://api.github.com/repos/normanjaeckel/OpenSlides/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/normanjaeckel/OpenSlides/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/normanjaeckel/OpenSlides/git/refs{/sha}","trees_url":"https://api.github.com/repos/normanjaeckel/OpenSlides/git/trees{/sha}","statuses_url":"https://api.github.com/repos/normanjaeckel/OpenSlides/statuses/{sha}","languages_url":"https://api.github.com/repos/normanjaeckel/OpenSlides/languages","stargazers_url":"https://api.github.com/repos/normanjaeckel/OpenSlides/stargazers","contributors_url":"https://api.github.com/repos/normanjaeckel/OpenSlides/contributors","subscribers_url":"https://api.github.com/repos/normanjaeckel/OpenSlides/subscribers","subscription_url":"https://api.github.com/repos/normanjaeckel/OpenSlides/subscription","commits_url":"https://api.github.com/repos/normanjaeckel/OpenSlides/commits{/sha}","git_commits_url":"https://api.github.com/repos/normanjaeckel/OpenSlides/git/commits{/sha}","comments_url":"https://api.github.com/repos/normanjaeckel/OpenSlides/comments{/number}","issue_comment_url":"https://api.github.com/repos/normanjaeckel/OpenSlides/issues/comments{/number}","contents_url":"https://api.github.com/repos/normanjaeckel/OpenSlides/contents/{+path}","compare_url":"https://api.github.com/repos/normanjaeckel/OpenSlides/compare/{base}...{head}","merges_url":"https://api.github.com/repos/normanjaeckel/OpenSlides/merges","archive_url":"https://api.github.com/repos/normanjaeckel/OpenSlides/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/normanjaeckel/OpenSlides/downloads","issues_url":"https://api.github.com/repos/normanjaeckel/OpenSlides/issues{/number}","pulls_url":"https://api.github.com/repos/normanjaeckel/OpenSlides/pulls{/number}","milestones_url":"https://api.github.com/repos/normanjaeckel/OpenSlides/milestones{/number}","notifications_url":"https://api.github.com/repos/normanjaeckel/OpenSlides/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/normanjaeckel/OpenSlides/labels{/name}","releases_url":"https://api.github.com/repos/normanjaeckel/OpenSlides/releases{/id}","created_at":"2012-08-09T20:52:48Z","updated_at":"2015-04-19T19:28:04Z","pushed_at":"2015-05-05T13:05:47Z","git_url":"git://github.com/normanjaeckel/OpenSlides.git","ssh_url":"git@github.com:normanjaeckel/OpenSlides.git","clone_url":"https://github.com/normanjaeckel/OpenSlides.git","svn_url":"https://github.com/normanjaeckel/OpenSlides","homepage":"http://openslides.org","size":37826,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"OpenSlides:master","ref":"master","sha":"9f93208afd065a622cad2b8c62de50db3525a89b","user":{"login":"OpenSlides","id":2055730,"avatar_url":"https://avatars.githubusercontent.com/u/2055730?v=3","gravatar_id":"","url":"https://api.github.com/users/OpenSlides","html_url":"https://github.com/OpenSlides","followers_url":"https://api.github.com/users/OpenSlides/followers","following_url":"https://api.github.com/users/OpenSlides/following{/other_user}","gists_url":"https://api.github.com/users/OpenSlides/gists{/gist_id}","starred_url":"https://api.github.com/users/OpenSlides/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OpenSlides/subscriptions","organizations_url":"https://api.github.com/users/OpenSlides/orgs","repos_url":"https://api.github.com/users/OpenSlides/repos","events_url":"https://api.github.com/users/OpenSlides/events{/privacy}","received_events_url":"https://api.github.com/users/OpenSlides/received_events","type":"Organization","site_admin":false},"repo":{"id":5250779,"name":"OpenSlides","full_name":"OpenSlides/OpenSlides","owner":{"login":"OpenSlides","id":2055730,"avatar_url":"https://avatars.githubusercontent.com/u/2055730?v=3","gravatar_id":"","url":"https://api.github.com/users/OpenSlides","html_url":"https://github.com/OpenSlides","followers_url":"https://api.github.com/users/OpenSlides/followers","following_url":"https://api.github.com/users/OpenSlides/following{/other_user}","gists_url":"https://api.github.com/users/OpenSlides/gists{/gist_id}","starred_url":"https://api.github.com/users/OpenSlides/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OpenSlides/subscriptions","organizations_url":"https://api.github.com/users/OpenSlides/orgs","repos_url":"https://api.github.com/users/OpenSlides/repos","events_url":"https://api.github.com/users/OpenSlides/events{/privacy}","received_events_url":"https://api.github.com/users/OpenSlides/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/OpenSlides/OpenSlides","description":"Presentation and assembly system","fork":false,"url":"https://api.github.com/repos/OpenSlides/OpenSlides","forks_url":"https://api.github.com/repos/OpenSlides/OpenSlides/forks","keys_url":"https://api.github.com/repos/OpenSlides/OpenSlides/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OpenSlides/OpenSlides/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OpenSlides/OpenSlides/teams","hooks_url":"https://api.github.com/repos/OpenSlides/OpenSlides/hooks","issue_events_url":"https://api.github.com/repos/OpenSlides/OpenSlides/issues/events{/number}","events_url":"https://api.github.com/repos/OpenSlides/OpenSlides/events","assignees_url":"https://api.github.com/repos/OpenSlides/OpenSlides/assignees{/user}","branches_url":"https://api.github.com/repos/OpenSlides/OpenSlides/branches{/branch}","tags_url":"https://api.github.com/repos/OpenSlides/OpenSlides/tags","blobs_url":"https://api.github.com/repos/OpenSlides/OpenSlides/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OpenSlides/OpenSlides/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OpenSlides/OpenSlides/git/refs{/sha}","trees_url":"https://api.github.com/repos/OpenSlides/OpenSlides/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OpenSlides/OpenSlides/statuses/{sha}","languages_url":"https://api.github.com/repos/OpenSlides/OpenSlides/languages","stargazers_url":"https://api.github.com/repos/OpenSlides/OpenSlides/stargazers","contributors_url":"https://api.github.com/repos/OpenSlides/OpenSlides/contributors","subscribers_url":"https://api.github.com/repos/OpenSlides/OpenSlides/subscribers","subscription_url":"https://api.github.com/repos/OpenSlides/OpenSlides/subscription","commits_url":"https://api.github.com/repos/OpenSlides/OpenSlides/commits{/sha}","git_commits_url":"https://api.github.com/repos/OpenSlides/OpenSlides/git/commits{/sha}","comments_url":"https://api.github.com/repos/OpenSlides/OpenSlides/comments{/number}","issue_comment_url":"https://api.github.com/repos/OpenSlides/OpenSlides/issues/comments{/number}","contents_url":"https://api.github.com/repos/OpenSlides/OpenSlides/contents/{+path}","compare_url":"https://api.github.com/repos/OpenSlides/OpenSlides/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OpenSlides/OpenSlides/merges","archive_url":"https://api.github.com/repos/OpenSlides/OpenSlides/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OpenSlides/OpenSlides/downloads","issues_url":"https://api.github.com/repos/OpenSlides/OpenSlides/issues{/number}","pulls_url":"https://api.github.com/repos/OpenSlides/OpenSlides/pulls{/number}","milestones_url":"https://api.github.com/repos/OpenSlides/OpenSlides/milestones{/number}","notifications_url":"https://api.github.com/repos/OpenSlides/OpenSlides/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OpenSlides/OpenSlides/labels{/name}","releases_url":"https://api.github.com/repos/OpenSlides/OpenSlides/releases{/id}","created_at":"2012-07-31T20:04:39Z","updated_at":"2015-05-06T07:18:40Z","pushed_at":"2015-05-12T12:12:10Z","git_url":"git://github.com/OpenSlides/OpenSlides.git","ssh_url":"git@github.com:OpenSlides/OpenSlides.git","clone_url":"https://github.com/OpenSlides/OpenSlides.git","svn_url":"https://github.com/OpenSlides/OpenSlides","homepage":"http://openslides.org","size":40312,"stargazers_count":65,"watchers_count":65,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":31,"mirror_url":null,"open_issues_count":117,"forks":31,"open_issues":117,"watchers":65,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/OpenSlides/OpenSlides/pulls/1517"},"html":{"href":"https://github.com/OpenSlides/OpenSlides/pull/1517"},"issue":{"href":"https://api.github.com/repos/OpenSlides/OpenSlides/issues/1517"},"comments":{"href":"https://api.github.com/repos/OpenSlides/OpenSlides/issues/1517/comments"},"review_comments":{"href":"https://api.github.com/repos/OpenSlides/OpenSlides/pulls/1517/comments"},"review_comment":{"href":"https://api.github.com/repos/OpenSlides/OpenSlides/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/OpenSlides/OpenSlides/pulls/1517/commits"},"statuses":{"href":"https://api.github.com/repos/OpenSlides/OpenSlides/statuses/08c5eda8769240fad7c7b2e73986a04731246710"}}}}