{"action":"created","comment":{"url":"https://api.github.com/repos/indico/indico/pulls/comments/58054703","id":58054703,"diff_hunk":"@@ -47,8 +47,25 @@ def _get_next_friendly_id(context):\n     return increment_and_get(Event._last_friendly_contribution_id, Event.id == event_id)\n \n \n+class CustomFieldsMixin(object):\n+    \"\"\"Methods to process custom field data.\"\"\"\n+\n+    def set_custom_field(self, field_id, field_value):\n+        fv = self.get_field_value(field_id, raw=True)\n+        if not fv:\n+            field_value_cls = type(self).field_values.prop.mapper.class_\n+            fv = field_value_cls(contribution_field=self.event_new.get_contribution_field(field_id), data=field_value)\n+            self.field_values.append(fv)\n+        fv.data = field_value\n+\n+    def set_custom_fields(self, custom_fields_data):","path":"indico/modules/events/contributions/models/contributions.py","position":15,"original_position":15,"commit_id":"c1fdaacb44438a737457ac095732cd397724efc9","original_commit_id":"c1fdaacb44438a737457ac095732cd397724efc9","user":{"login":"ThiefMaster","id":179599,"avatar_url":"https://avatars.githubusercontent.com/u/179599?v=3","gravatar_id":"","url":"https://api.github.com/users/ThiefMaster","html_url":"https://github.com/ThiefMaster","followers_url":"https://api.github.com/users/ThiefMaster/followers","following_url":"https://api.github.com/users/ThiefMaster/following{/other_user}","gists_url":"https://api.github.com/users/ThiefMaster/gists{/gist_id}","starred_url":"https://api.github.com/users/ThiefMaster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ThiefMaster/subscriptions","organizations_url":"https://api.github.com/users/ThiefMaster/orgs","repos_url":"https://api.github.com/users/ThiefMaster/repos","events_url":"https://api.github.com/users/ThiefMaster/events{/privacy}","received_events_url":"https://api.github.com/users/ThiefMaster/received_events","type":"User","site_admin":false},"body":"not a big fan of having this in the model due to the `custom_` prefix handling. that's much closer to the operation than the model.. maybe move this to `_set_custom_fields` in operations.py?","created_at":"2016-03-31T13:42:03Z","updated_at":"2016-03-31T13:42:03Z","html_url":"https://github.com/indico/indico/pull/2308#discussion_r58054703","pull_request_url":"https://api.github.com/repos/indico/indico/pulls/2308","_links":{"self":{"href":"https://api.github.com/repos/indico/indico/pulls/comments/58054703"},"html":{"href":"https://github.com/indico/indico/pull/2308#discussion_r58054703"},"pull_request":{"href":"https://api.github.com/repos/indico/indico/pulls/2308"}}},"pull_request":{"url":"https://api.github.com/repos/indico/indico/pulls/2308","id":64060840,"html_url":"https://github.com/indico/indico/pull/2308","diff_url":"https://github.com/indico/indico/pull/2308.diff","patch_url":"https://github.com/indico/indico/pull/2308.patch","issue_url":"https://api.github.com/repos/indico/indico/issues/2308","number":2308,"state":"open","locked":false,"title":"Handle custom fields in the contribution dialogs","user":{"login":"nop33","id":1579899,"avatar_url":"https://avatars.githubusercontent.com/u/1579899?v=3","gravatar_id":"","url":"https://api.github.com/users/nop33","html_url":"https://github.com/nop33","followers_url":"https://api.github.com/users/nop33/followers","following_url":"https://api.github.com/users/nop33/following{/other_user}","gists_url":"https://api.github.com/users/nop33/gists{/gist_id}","starred_url":"https://api.github.com/users/nop33/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nop33/subscriptions","organizations_url":"https://api.github.com/users/nop33/orgs","repos_url":"https://api.github.com/users/nop33/repos","events_url":"https://api.github.com/users/nop33/events{/privacy}","received_events_url":"https://api.github.com/users/nop33/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-03-24T16:30:27Z","updated_at":"2016-03-31T13:42:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2b74468db225022a6460ec5bef824e3b7bb5bf2f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/indico/indico/pulls/2308/commits","review_comments_url":"https://api.github.com/repos/indico/indico/pulls/2308/comments","review_comment_url":"https://api.github.com/repos/indico/indico/pulls/comments{/number}","comments_url":"https://api.github.com/repos/indico/indico/issues/2308/comments","statuses_url":"https://api.github.com/repos/indico/indico/statuses/c1fdaacb44438a737457ac095732cd397724efc9","head":{"label":"nop33:wip/extra-fields-contrib-ui","ref":"wip/extra-fields-contrib-ui","sha":"c1fdaacb44438a737457ac095732cd397724efc9","user":{"login":"nop33","id":1579899,"avatar_url":"https://avatars.githubusercontent.com/u/1579899?v=3","gravatar_id":"","url":"https://api.github.com/users/nop33","html_url":"https://github.com/nop33","followers_url":"https://api.github.com/users/nop33/followers","following_url":"https://api.github.com/users/nop33/following{/other_user}","gists_url":"https://api.github.com/users/nop33/gists{/gist_id}","starred_url":"https://api.github.com/users/nop33/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nop33/subscriptions","organizations_url":"https://api.github.com/users/nop33/orgs","repos_url":"https://api.github.com/users/nop33/repos","events_url":"https://api.github.com/users/nop33/events{/privacy}","received_events_url":"https://api.github.com/users/nop33/received_events","type":"User","site_admin":false},"repo":{"id":22684703,"name":"indico","full_name":"nop33/indico","owner":{"login":"nop33","id":1579899,"avatar_url":"https://avatars.githubusercontent.com/u/1579899?v=3","gravatar_id":"","url":"https://api.github.com/users/nop33","html_url":"https://github.com/nop33","followers_url":"https://api.github.com/users/nop33/followers","following_url":"https://api.github.com/users/nop33/following{/other_user}","gists_url":"https://api.github.com/users/nop33/gists{/gist_id}","starred_url":"https://api.github.com/users/nop33/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nop33/subscriptions","organizations_url":"https://api.github.com/users/nop33/orgs","repos_url":"https://api.github.com/users/nop33/repos","events_url":"https://api.github.com/users/nop33/events{/privacy}","received_events_url":"https://api.github.com/users/nop33/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nop33/indico","description":"The Indico Project (mirror)","fork":true,"url":"https://api.github.com/repos/nop33/indico","forks_url":"https://api.github.com/repos/nop33/indico/forks","keys_url":"https://api.github.com/repos/nop33/indico/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nop33/indico/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nop33/indico/teams","hooks_url":"https://api.github.com/repos/nop33/indico/hooks","issue_events_url":"https://api.github.com/repos/nop33/indico/issues/events{/number}","events_url":"https://api.github.com/repos/nop33/indico/events","assignees_url":"https://api.github.com/repos/nop33/indico/assignees{/user}","branches_url":"https://api.github.com/repos/nop33/indico/branches{/branch}","tags_url":"https://api.github.com/repos/nop33/indico/tags","blobs_url":"https://api.github.com/repos/nop33/indico/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nop33/indico/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nop33/indico/git/refs{/sha}","trees_url":"https://api.github.com/repos/nop33/indico/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nop33/indico/statuses/{sha}","languages_url":"https://api.github.com/repos/nop33/indico/languages","stargazers_url":"https://api.github.com/repos/nop33/indico/stargazers","contributors_url":"https://api.github.com/repos/nop33/indico/contributors","subscribers_url":"https://api.github.com/repos/nop33/indico/subscribers","subscription_url":"https://api.github.com/repos/nop33/indico/subscription","commits_url":"https://api.github.com/repos/nop33/indico/commits{/sha}","git_commits_url":"https://api.github.com/repos/nop33/indico/git/commits{/sha}","comments_url":"https://api.github.com/repos/nop33/indico/comments{/number}","issue_comment_url":"https://api.github.com/repos/nop33/indico/issues/comments{/number}","contents_url":"https://api.github.com/repos/nop33/indico/contents/{+path}","compare_url":"https://api.github.com/repos/nop33/indico/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nop33/indico/merges","archive_url":"https://api.github.com/repos/nop33/indico/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nop33/indico/downloads","issues_url":"https://api.github.com/repos/nop33/indico/issues{/number}","pulls_url":"https://api.github.com/repos/nop33/indico/pulls{/number}","milestones_url":"https://api.github.com/repos/nop33/indico/milestones{/number}","notifications_url":"https://api.github.com/repos/nop33/indico/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nop33/indico/labels{/name}","releases_url":"https://api.github.com/repos/nop33/indico/releases{/id}","deployments_url":"https://api.github.com/repos/nop33/indico/deployments","created_at":"2014-08-06T14:02:24Z","updated_at":"2015-09-07T15:17:59Z","pushed_at":"2016-03-30T12:51:42Z","git_url":"git://github.com/nop33/indico.git","ssh_url":"git@github.com:nop33/indico.git","clone_url":"https://github.com/nop33/indico.git","svn_url":"https://github.com/nop33/indico","homepage":"http://indico-software.org","size":183576,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"indico:devel","ref":"devel","sha":"fd81647a38abb3f47a553e7e07f68d373ccaf98a","user":{"login":"indico","id":715236,"avatar_url":"https://avatars.githubusercontent.com/u/715236?v=3","gravatar_id":"","url":"https://api.github.com/users/indico","html_url":"https://github.com/indico","followers_url":"https://api.github.com/users/indico/followers","following_url":"https://api.github.com/users/indico/following{/other_user}","gists_url":"https://api.github.com/users/indico/gists{/gist_id}","starred_url":"https://api.github.com/users/indico/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/indico/subscriptions","organizations_url":"https://api.github.com/users/indico/orgs","repos_url":"https://api.github.com/users/indico/repos","events_url":"https://api.github.com/users/indico/events{/privacy}","received_events_url":"https://api.github.com/users/indico/received_events","type":"Organization","site_admin":false},"repo":{"id":2113067,"name":"indico","full_name":"indico/indico","owner":{"login":"indico","id":715236,"avatar_url":"https://avatars.githubusercontent.com/u/715236?v=3","gravatar_id":"","url":"https://api.github.com/users/indico","html_url":"https://github.com/indico","followers_url":"https://api.github.com/users/indico/followers","following_url":"https://api.github.com/users/indico/following{/other_user}","gists_url":"https://api.github.com/users/indico/gists{/gist_id}","starred_url":"https://api.github.com/users/indico/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/indico/subscriptions","organizations_url":"https://api.github.com/users/indico/orgs","repos_url":"https://api.github.com/users/indico/repos","events_url":"https://api.github.com/users/indico/events{/privacy}","received_events_url":"https://api.github.com/users/indico/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/indico/indico","description":"The Indico Project","fork":false,"url":"https://api.github.com/repos/indico/indico","forks_url":"https://api.github.com/repos/indico/indico/forks","keys_url":"https://api.github.com/repos/indico/indico/keys{/key_id}","collaborators_url":"https://api.github.com/repos/indico/indico/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/indico/indico/teams","hooks_url":"https://api.github.com/repos/indico/indico/hooks","issue_events_url":"https://api.github.com/repos/indico/indico/issues/events{/number}","events_url":"https://api.github.com/repos/indico/indico/events","assignees_url":"https://api.github.com/repos/indico/indico/assignees{/user}","branches_url":"https://api.github.com/repos/indico/indico/branches{/branch}","tags_url":"https://api.github.com/repos/indico/indico/tags","blobs_url":"https://api.github.com/repos/indico/indico/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/indico/indico/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/indico/indico/git/refs{/sha}","trees_url":"https://api.github.com/repos/indico/indico/git/trees{/sha}","statuses_url":"https://api.github.com/repos/indico/indico/statuses/{sha}","languages_url":"https://api.github.com/repos/indico/indico/languages","stargazers_url":"https://api.github.com/repos/indico/indico/stargazers","contributors_url":"https://api.github.com/repos/indico/indico/contributors","subscribers_url":"https://api.github.com/repos/indico/indico/subscribers","subscription_url":"https://api.github.com/repos/indico/indico/subscription","commits_url":"https://api.github.com/repos/indico/indico/commits{/sha}","git_commits_url":"https://api.github.com/repos/indico/indico/git/commits{/sha}","comments_url":"https://api.github.com/repos/indico/indico/comments{/number}","issue_comment_url":"https://api.github.com/repos/indico/indico/issues/comments{/number}","contents_url":"https://api.github.com/repos/indico/indico/contents/{+path}","compare_url":"https://api.github.com/repos/indico/indico/compare/{base}...{head}","merges_url":"https://api.github.com/repos/indico/indico/merges","archive_url":"https://api.github.com/repos/indico/indico/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/indico/indico/downloads","issues_url":"https://api.github.com/repos/indico/indico/issues{/number}","pulls_url":"https://api.github.com/repos/indico/indico/pulls{/number}","milestones_url":"https://api.github.com/repos/indico/indico/milestones{/number}","notifications_url":"https://api.github.com/repos/indico/indico/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/indico/indico/labels{/name}","releases_url":"https://api.github.com/repos/indico/indico/releases{/id}","deployments_url":"https://api.github.com/repos/indico/indico/deployments","created_at":"2011-07-27T13:56:30Z","updated_at":"2016-03-30T15:54:36Z","pushed_at":"2016-03-31T13:38:59Z","git_url":"git://github.com/indico/indico.git","ssh_url":"git@github.com:indico/indico.git","clone_url":"https://github.com/indico/indico.git","svn_url":"https://github.com/indico/indico","homepage":"http://indico-software.org","size":195040,"stargazers_count":134,"watchers_count":134,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":69,"mirror_url":null,"open_issues_count":592,"forks":69,"open_issues":592,"watchers":134,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/indico/indico/pulls/2308"},"html":{"href":"https://github.com/indico/indico/pull/2308"},"issue":{"href":"https://api.github.com/repos/indico/indico/issues/2308"},"comments":{"href":"https://api.github.com/repos/indico/indico/issues/2308/comments"},"review_comments":{"href":"https://api.github.com/repos/indico/indico/pulls/2308/comments"},"review_comment":{"href":"https://api.github.com/repos/indico/indico/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/indico/indico/pulls/2308/commits"},"statuses":{"href":"https://api.github.com/repos/indico/indico/statuses/c1fdaacb44438a737457ac095732cd397724efc9"}}}}