{"action":"created","comment":{"url":"https://api.github.com/repos/karpenoktem/kninfra/pulls/comments/32345145","id":32345145,"diff_hunk":"@@ -1,30 +1,64 @@\n import decimal\n+import datetime\n \n from django.db.models import permalink\n from django.utils.html import escape, linebreaks\n from django.core.mail import EmailMessage\n+from django.core.urlresolvers import reverse\n from django.conf import settings\n \n-from kn.leden.mongo import db, SONWrapper, _id, son_property, ObjectId\n+from kn.leden.mongo import db, SONWrapper, _id, son_property\n import kn.leden.entities as Es\n \n ecol = db['events']\n-scol = db['event_subscriptions']\n+\n+# Example of an event\n+# ------------------\n+# { \"_id\" : ObjectId(\"55631d03ed25c3345751714a\"),\n+#   \"humanName\" : \"Activiteit van de LoCo\",\n+#   \"cost\" : \"0\",\n+#   \"is_open\" : true,\n+#   \"owner\" : ObjectId(\"4e6fcc85e60edf3dc000006f\"),\n+#   \"is_official\" : false,\n+#   \"description_html\" : \"<p>Beschrijving van de activiteit (in <strong>Markdown</strong>).</p>\",\n+#   \"mailBody\" : \"Hallo %(firstName)s,\\r\\n\\r\\nJe hebt je aangemeld voor %(eventName)s.\\r\\n\\r\\nJe opmerkingen waren:\\r\\n%(notes)s\\r\\n\\r\\nMet een vriendelijke groet,\\r\\n\\r\\n%(owner)s\",\n+#   \"description\" : \"Beschrijving van de activiteit (in **Markdown**).\",\n+#   \"subscriptions\" : [\n+#       { \"user\" : ObjectId(\"4e6fcc85e60edf3dc0000b9f\"),\n+#         \"inviter\" : ObjectId(\"50f29894d4080076aa541de2\"),\n+#         \"inviterNotes\" : \"foo\",\n+#         \"inviteDate\" : ISODate(\"2015-06-10T19:36:50.352Z\"),\n+#         \"history\" : [ { \"date\" : ISODate(\"2015-06-10T19:37:01.992Z\"),\n+#                         \"state\" : \"subscribed\",","path":"kn/subscriptions/entities.py","position":34,"original_position":34,"commit_id":"64e22b95b7779a6e1bc9111770c71d099dac1a3e","original_commit_id":"64e22b95b7779a6e1bc9111770c71d099dac1a3e","user":{"login":"aykevl","id":729697,"avatar_url":"https://avatars.githubusercontent.com/u/729697?v=3","gravatar_id":"","url":"https://api.github.com/users/aykevl","html_url":"https://github.com/aykevl","followers_url":"https://api.github.com/users/aykevl/followers","following_url":"https://api.github.com/users/aykevl/following{/other_user}","gists_url":"https://api.github.com/users/aykevl/gists{/gist_id}","starred_url":"https://api.github.com/users/aykevl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aykevl/subscriptions","organizations_url":"https://api.github.com/users/aykevl/orgs","repos_url":"https://api.github.com/users/aykevl/repos","events_url":"https://api.github.com/users/aykevl/events{/privacy}","received_events_url":"https://api.github.com/users/aykevl/received_events","type":"User","site_admin":false},"body":"Tot nu toe alleen nog maar \"subscribed\". Later zou daar ook \"unsubscribed\" of zelfs \"reserve\" bij kunnen komen.","created_at":"2015-06-12T19:06:43Z","updated_at":"2015-06-12T19:06:43Z","html_url":"https://github.com/karpenoktem/kninfra/pull/301#discussion_r32345145","pull_request_url":"https://api.github.com/repos/karpenoktem/kninfra/pulls/301","_links":{"self":{"href":"https://api.github.com/repos/karpenoktem/kninfra/pulls/comments/32345145"},"html":{"href":"https://github.com/karpenoktem/kninfra/pull/301#discussion_r32345145"},"pull_request":{"href":"https://api.github.com/repos/karpenoktem/kninfra/pulls/301"}}},"pull_request":{"url":"https://api.github.com/repos/karpenoktem/kninfra/pulls/301","id":37386690,"html_url":"https://github.com/karpenoktem/kninfra/pull/301","diff_url":"https://github.com/karpenoktem/kninfra/pull/301.diff","patch_url":"https://github.com/karpenoktem/kninfra/pull/301.patch","issue_url":"https://api.github.com/repos/karpenoktem/kninfra/issues/301","number":301,"state":"open","locked":false,"title":"Nieuwe subscriptions","user":{"login":"aykevl","id":729697,"avatar_url":"https://avatars.githubusercontent.com/u/729697?v=3","gravatar_id":"","url":"https://api.github.com/users/aykevl","html_url":"https://github.com/aykevl","followers_url":"https://api.github.com/users/aykevl/followers","following_url":"https://api.github.com/users/aykevl/following{/other_user}","gists_url":"https://api.github.com/users/aykevl/gists{/gist_id}","starred_url":"https://api.github.com/users/aykevl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aykevl/subscriptions","organizations_url":"https://api.github.com/users/aykevl/orgs","repos_url":"https://api.github.com/users/aykevl/repos","events_url":"https://api.github.com/users/aykevl/events{/privacy}","received_events_url":"https://api.github.com/users/aykevl/received_events","type":"User","site_admin":false},"body":"Dit is een grote update aan de subscriptions. Het verandert weinig aan de functionaliteit, maar gebruikt een heel nieuw data model dat toekomstige wijzigingen (zoals uitschrijven bij activiteiten) eenvoudig maakt.\r\n\r\nDe enige functionele aanpassingen die hier in zitten is dat alles dat met debet te maken heeft is verwijderd en dat 'iemand anders aanmelden' zoveel mogelijk is vervangen door 'iemand anders uitnodigen', want dat is wat het in de praktijk betekent (een onbevestigde aanmelding is geen aanmelding, dus eigenlijk een uitnodiging).\r\n\r\nIk heb het best redelijk getest, maar omdat er maar foutjes in bleven zitten moet het nog eens goed op khandhas getest worden. Bovendien was het conversiescriptje niet heel goed te testen aangezien de database van khandhas maar weinig (test)aanmeldingen bevatte.\r\n\r\nHelaas moest het in een keer, deze aanpassing in kleine stukjes doen bleek erg moeilijk en ik vond het niet de moeite.","created_at":"2015-06-10T18:04:02Z","updated_at":"2015-06-12T19:06:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4bec25ab0a55b1f8a0a6c87ca49281182bcaf73a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/karpenoktem/kninfra/pulls/301/commits","review_comments_url":"https://api.github.com/repos/karpenoktem/kninfra/pulls/301/comments","review_comment_url":"https://api.github.com/repos/karpenoktem/kninfra/pulls/comments{/number}","comments_url":"https://api.github.com/repos/karpenoktem/kninfra/issues/301/comments","statuses_url":"https://api.github.com/repos/karpenoktem/kninfra/statuses/64e22b95b7779a6e1bc9111770c71d099dac1a3e","head":{"label":"aykevl:subscriptions2","ref":"subscriptions2","sha":"64e22b95b7779a6e1bc9111770c71d099dac1a3e","user":{"login":"aykevl","id":729697,"avatar_url":"https://avatars.githubusercontent.com/u/729697?v=3","gravatar_id":"","url":"https://api.github.com/users/aykevl","html_url":"https://github.com/aykevl","followers_url":"https://api.github.com/users/aykevl/followers","following_url":"https://api.github.com/users/aykevl/following{/other_user}","gists_url":"https://api.github.com/users/aykevl/gists{/gist_id}","starred_url":"https://api.github.com/users/aykevl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aykevl/subscriptions","organizations_url":"https://api.github.com/users/aykevl/orgs","repos_url":"https://api.github.com/users/aykevl/repos","events_url":"https://api.github.com/users/aykevl/events{/privacy}","received_events_url":"https://api.github.com/users/aykevl/received_events","type":"User","site_admin":false},"repo":{"id":7627453,"name":"kninfra","full_name":"aykevl/kninfra","owner":{"login":"aykevl","id":729697,"avatar_url":"https://avatars.githubusercontent.com/u/729697?v=3","gravatar_id":"","url":"https://api.github.com/users/aykevl","html_url":"https://github.com/aykevl","followers_url":"https://api.github.com/users/aykevl/followers","following_url":"https://api.github.com/users/aykevl/following{/other_user}","gists_url":"https://api.github.com/users/aykevl/gists{/gist_id}","starred_url":"https://api.github.com/users/aykevl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aykevl/subscriptions","organizations_url":"https://api.github.com/users/aykevl/orgs","repos_url":"https://api.github.com/users/aykevl/repos","events_url":"https://api.github.com/users/aykevl/events{/privacy}","received_events_url":"https://api.github.com/users/aykevl/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/aykevl/kninfra","description":"Digital infrastructure of Karpe Noktem","fork":true,"url":"https://api.github.com/repos/aykevl/kninfra","forks_url":"https://api.github.com/repos/aykevl/kninfra/forks","keys_url":"https://api.github.com/repos/aykevl/kninfra/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aykevl/kninfra/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aykevl/kninfra/teams","hooks_url":"https://api.github.com/repos/aykevl/kninfra/hooks","issue_events_url":"https://api.github.com/repos/aykevl/kninfra/issues/events{/number}","events_url":"https://api.github.com/repos/aykevl/kninfra/events","assignees_url":"https://api.github.com/repos/aykevl/kninfra/assignees{/user}","branches_url":"https://api.github.com/repos/aykevl/kninfra/branches{/branch}","tags_url":"https://api.github.com/repos/aykevl/kninfra/tags","blobs_url":"https://api.github.com/repos/aykevl/kninfra/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aykevl/kninfra/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aykevl/kninfra/git/refs{/sha}","trees_url":"https://api.github.com/repos/aykevl/kninfra/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aykevl/kninfra/statuses/{sha}","languages_url":"https://api.github.com/repos/aykevl/kninfra/languages","stargazers_url":"https://api.github.com/repos/aykevl/kninfra/stargazers","contributors_url":"https://api.github.com/repos/aykevl/kninfra/contributors","subscribers_url":"https://api.github.com/repos/aykevl/kninfra/subscribers","subscription_url":"https://api.github.com/repos/aykevl/kninfra/subscription","commits_url":"https://api.github.com/repos/aykevl/kninfra/commits{/sha}","git_commits_url":"https://api.github.com/repos/aykevl/kninfra/git/commits{/sha}","comments_url":"https://api.github.com/repos/aykevl/kninfra/comments{/number}","issue_comment_url":"https://api.github.com/repos/aykevl/kninfra/issues/comments{/number}","contents_url":"https://api.github.com/repos/aykevl/kninfra/contents/{+path}","compare_url":"https://api.github.com/repos/aykevl/kninfra/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aykevl/kninfra/merges","archive_url":"https://api.github.com/repos/aykevl/kninfra/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aykevl/kninfra/downloads","issues_url":"https://api.github.com/repos/aykevl/kninfra/issues{/number}","pulls_url":"https://api.github.com/repos/aykevl/kninfra/pulls{/number}","milestones_url":"https://api.github.com/repos/aykevl/kninfra/milestones{/number}","notifications_url":"https://api.github.com/repos/aykevl/kninfra/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aykevl/kninfra/labels{/name}","releases_url":"https://api.github.com/repos/aykevl/kninfra/releases{/id}","created_at":"2013-01-15T15:32:10Z","updated_at":"2015-04-24T17:48:01Z","pushed_at":"2015-06-11T12:02:35Z","git_url":"git://github.com/aykevl/kninfra.git","ssh_url":"git@github.com:aykevl/kninfra.git","clone_url":"https://github.com/aykevl/kninfra.git","svn_url":"https://github.com/aykevl/kninfra","homepage":"http://karpenoktem.nl/","size":27666,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"karpenoktem:master","ref":"master","sha":"e0f6ebf7a2999df9895111508c4e4fd0c4512af7","user":{"login":"karpenoktem","id":460625,"avatar_url":"https://avatars.githubusercontent.com/u/460625?v=3","gravatar_id":"","url":"https://api.github.com/users/karpenoktem","html_url":"https://github.com/karpenoktem","followers_url":"https://api.github.com/users/karpenoktem/followers","following_url":"https://api.github.com/users/karpenoktem/following{/other_user}","gists_url":"https://api.github.com/users/karpenoktem/gists{/gist_id}","starred_url":"https://api.github.com/users/karpenoktem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/karpenoktem/subscriptions","organizations_url":"https://api.github.com/users/karpenoktem/orgs","repos_url":"https://api.github.com/users/karpenoktem/repos","events_url":"https://api.github.com/users/karpenoktem/events{/privacy}","received_events_url":"https://api.github.com/users/karpenoktem/received_events","type":"Organization","site_admin":false},"repo":{"id":1037232,"name":"kninfra","full_name":"karpenoktem/kninfra","owner":{"login":"karpenoktem","id":460625,"avatar_url":"https://avatars.githubusercontent.com/u/460625?v=3","gravatar_id":"","url":"https://api.github.com/users/karpenoktem","html_url":"https://github.com/karpenoktem","followers_url":"https://api.github.com/users/karpenoktem/followers","following_url":"https://api.github.com/users/karpenoktem/following{/other_user}","gists_url":"https://api.github.com/users/karpenoktem/gists{/gist_id}","starred_url":"https://api.github.com/users/karpenoktem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/karpenoktem/subscriptions","organizations_url":"https://api.github.com/users/karpenoktem/orgs","repos_url":"https://api.github.com/users/karpenoktem/repos","events_url":"https://api.github.com/users/karpenoktem/events{/privacy}","received_events_url":"https://api.github.com/users/karpenoktem/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/karpenoktem/kninfra","description":"Digital infrastructure of Karpe Noktem","fork":false,"url":"https://api.github.com/repos/karpenoktem/kninfra","forks_url":"https://api.github.com/repos/karpenoktem/kninfra/forks","keys_url":"https://api.github.com/repos/karpenoktem/kninfra/keys{/key_id}","collaborators_url":"https://api.github.com/repos/karpenoktem/kninfra/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/karpenoktem/kninfra/teams","hooks_url":"https://api.github.com/repos/karpenoktem/kninfra/hooks","issue_events_url":"https://api.github.com/repos/karpenoktem/kninfra/issues/events{/number}","events_url":"https://api.github.com/repos/karpenoktem/kninfra/events","assignees_url":"https://api.github.com/repos/karpenoktem/kninfra/assignees{/user}","branches_url":"https://api.github.com/repos/karpenoktem/kninfra/branches{/branch}","tags_url":"https://api.github.com/repos/karpenoktem/kninfra/tags","blobs_url":"https://api.github.com/repos/karpenoktem/kninfra/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/karpenoktem/kninfra/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/karpenoktem/kninfra/git/refs{/sha}","trees_url":"https://api.github.com/repos/karpenoktem/kninfra/git/trees{/sha}","statuses_url":"https://api.github.com/repos/karpenoktem/kninfra/statuses/{sha}","languages_url":"https://api.github.com/repos/karpenoktem/kninfra/languages","stargazers_url":"https://api.github.com/repos/karpenoktem/kninfra/stargazers","contributors_url":"https://api.github.com/repos/karpenoktem/kninfra/contributors","subscribers_url":"https://api.github.com/repos/karpenoktem/kninfra/subscribers","subscription_url":"https://api.github.com/repos/karpenoktem/kninfra/subscription","commits_url":"https://api.github.com/repos/karpenoktem/kninfra/commits{/sha}","git_commits_url":"https://api.github.com/repos/karpenoktem/kninfra/git/commits{/sha}","comments_url":"https://api.github.com/repos/karpenoktem/kninfra/comments{/number}","issue_comment_url":"https://api.github.com/repos/karpenoktem/kninfra/issues/comments{/number}","contents_url":"https://api.github.com/repos/karpenoktem/kninfra/contents/{+path}","compare_url":"https://api.github.com/repos/karpenoktem/kninfra/compare/{base}...{head}","merges_url":"https://api.github.com/repos/karpenoktem/kninfra/merges","archive_url":"https://api.github.com/repos/karpenoktem/kninfra/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/karpenoktem/kninfra/downloads","issues_url":"https://api.github.com/repos/karpenoktem/kninfra/issues{/number}","pulls_url":"https://api.github.com/repos/karpenoktem/kninfra/pulls{/number}","milestones_url":"https://api.github.com/repos/karpenoktem/kninfra/milestones{/number}","notifications_url":"https://api.github.com/repos/karpenoktem/kninfra/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/karpenoktem/kninfra/labels{/name}","releases_url":"https://api.github.com/repos/karpenoktem/kninfra/releases{/id}","created_at":"2010-10-30T11:19:48Z","updated_at":"2015-05-14T10:02:54Z","pushed_at":"2015-06-11T14:56:21Z","git_url":"git://github.com/karpenoktem/kninfra.git","ssh_url":"git@github.com:karpenoktem/kninfra.git","clone_url":"https://github.com/karpenoktem/kninfra.git","svn_url":"https://github.com/karpenoktem/kninfra","homepage":"http://karpenoktem.nl/","size":28488,"stargazers_count":7,"watchers_count":7,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":10,"mirror_url":null,"open_issues_count":49,"forks":10,"open_issues":49,"watchers":7,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/karpenoktem/kninfra/pulls/301"},"html":{"href":"https://github.com/karpenoktem/kninfra/pull/301"},"issue":{"href":"https://api.github.com/repos/karpenoktem/kninfra/issues/301"},"comments":{"href":"https://api.github.com/repos/karpenoktem/kninfra/issues/301/comments"},"review_comments":{"href":"https://api.github.com/repos/karpenoktem/kninfra/pulls/301/comments"},"review_comment":{"href":"https://api.github.com/repos/karpenoktem/kninfra/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/karpenoktem/kninfra/pulls/301/commits"},"statuses":{"href":"https://api.github.com/repos/karpenoktem/kninfra/statuses/64e22b95b7779a6e1bc9111770c71d099dac1a3e"}}}}