{"action":"created","comment":{"url":"https://api.github.com/repos/dimagi/commcare-hq/pulls/comments/24355194","id":24355194,"diff_hunk":"@@ -264,3 +262,56 @@ def mk_action(action):\n         self.domain_object.commtrack_settings.save()\n \n         return self.get(request, *args, **kwargs)\n+\n+\n+class StockLevelsView(BaseCommTrackManageView):\n+    urlname = 'stock_levels'\n+    page_title = ugettext_noop(\"Stock Levels\")\n+    template_name = 'commtrack/manage/stock_levels.html'\n+\n+    def get_existing_stock_levels(self):\n+        \"\"\"\n+        Returns a list of dicts of this form:\n+        {\n+            'loc_type': 'district,\n+            'emergency_level': 0.5,\n+            'understock_threshold': 1.5,\n+            'overstock_threshold': 3,\n+        }\n+        \"\"\"\n+        return [{\n+            'loc_type': loc_type.name,\n+            'emergency_level': 0.5,\n+            'understock_threshold': 1.5,\n+            'overstock_threshold': 3,\n+        } for loc_type in self.domain_object.location_types]\n+\n+    def save_stock_levels(self, levels):\n+        \"\"\"\n+        Accepts a dict of the form returned by get_existing_stock_levels\n+        \"\"\"\n+        for d in levels:\n+            print d.values()\n+            print \"saved levels for {}\".format(d['loc_type'])","path":"corehq/apps/commtrack/views.py","position":89,"original_position":89,"commit_id":"60143408583daa273f8f482c1453d5bce6018d8e","original_commit_id":"60143408583daa273f8f482c1453d5bce6018d8e","user":{"login":"twymer","id":152134,"avatar_url":"https://avatars.githubusercontent.com/u/152134?v=3","gravatar_id":"","url":"https://api.github.com/users/twymer","html_url":"https://github.com/twymer","followers_url":"https://api.github.com/users/twymer/followers","following_url":"https://api.github.com/users/twymer/following{/other_user}","gists_url":"https://api.github.com/users/twymer/gists{/gist_id}","starred_url":"https://api.github.com/users/twymer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/twymer/subscriptions","organizations_url":"https://api.github.com/users/twymer/orgs","repos_url":"https://api.github.com/users/twymer/repos","events_url":"https://api.github.com/users/twymer/events{/privacy}","received_events_url":"https://api.github.com/users/twymer/received_events","type":"User","site_admin":false},"body":"Oh it's hard coded because this doesn't save yet ;)","created_at":"2015-02-09T19:08:18Z","updated_at":"2015-02-09T19:08:18Z","html_url":"https://github.com/dimagi/commcare-hq/pull/5489#discussion_r24355194","pull_request_url":"https://api.github.com/repos/dimagi/commcare-hq/pulls/5489","_links":{"self":{"href":"https://api.github.com/repos/dimagi/commcare-hq/pulls/comments/24355194"},"html":{"href":"https://github.com/dimagi/commcare-hq/pull/5489#discussion_r24355194"},"pull_request":{"href":"https://api.github.com/repos/dimagi/commcare-hq/pulls/5489"}}},"pull_request":{"url":"https://api.github.com/repos/dimagi/commcare-hq/pulls/5489","id":28944561,"html_url":"https://github.com/dimagi/commcare-hq/pull/5489","diff_url":"https://github.com/dimagi/commcare-hq/pull/5489.diff","patch_url":"https://github.com/dimagi/commcare-hq/pull/5489.patch","issue_url":"https://api.github.com/repos/dimagi/commcare-hq/issues/5489","number":5489,"state":"open","locked":false,"title":"Set up view to edit stock levels","user":{"login":"esoergel","id":2367539,"avatar_url":"https://avatars.githubusercontent.com/u/2367539?v=3","gravatar_id":"","url":"https://api.github.com/users/esoergel","html_url":"https://github.com/esoergel","followers_url":"https://api.github.com/users/esoergel/followers","following_url":"https://api.github.com/users/esoergel/following{/other_user}","gists_url":"https://api.github.com/users/esoergel/gists{/gist_id}","starred_url":"https://api.github.com/users/esoergel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/esoergel/subscriptions","organizations_url":"https://api.github.com/users/esoergel/orgs","repos_url":"https://api.github.com/users/esoergel/repos","events_url":"https://api.github.com/users/esoergel/events{/privacy}","received_events_url":"https://api.github.com/users/esoergel/received_events","type":"User","site_admin":false},"body":"http://manage.dimagi.com/default.asp?151261\n@twymer\nThe UI for this is finished, I just need to actually save the data.  Figured it makes sense to get this merged (it's behind a feature flag) now, so it can be PR'd separately from the location types stuff.","created_at":"2015-02-09T18:30:54Z","updated_at":"2015-02-09T19:08:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"70b9202bb057c5c6659de42a0248104a5d440254","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/dimagi/commcare-hq/pulls/5489/commits","review_comments_url":"https://api.github.com/repos/dimagi/commcare-hq/pulls/5489/comments","review_comment_url":"https://api.github.com/repos/dimagi/commcare-hq/pulls/comments/{number}","comments_url":"https://api.github.com/repos/dimagi/commcare-hq/issues/5489/comments","statuses_url":"https://api.github.com/repos/dimagi/commcare-hq/statuses/60143408583daa273f8f482c1453d5bce6018d8e","head":{"label":"dimagi:stock-rates","ref":"stock-rates","sha":"60143408583daa273f8f482c1453d5bce6018d8e","user":{"login":"dimagi","id":94514,"avatar_url":"https://avatars.githubusercontent.com/u/94514?v=3","gravatar_id":"","url":"https://api.github.com/users/dimagi","html_url":"https://github.com/dimagi","followers_url":"https://api.github.com/users/dimagi/followers","following_url":"https://api.github.com/users/dimagi/following{/other_user}","gists_url":"https://api.github.com/users/dimagi/gists{/gist_id}","starred_url":"https://api.github.com/users/dimagi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dimagi/subscriptions","organizations_url":"https://api.github.com/users/dimagi/orgs","repos_url":"https://api.github.com/users/dimagi/repos","events_url":"https://api.github.com/users/dimagi/events{/privacy}","received_events_url":"https://api.github.com/users/dimagi/received_events","type":"Organization","site_admin":false},"repo":{"id":247278,"name":"commcare-hq","full_name":"dimagi/commcare-hq","owner":{"login":"dimagi","id":94514,"avatar_url":"https://avatars.githubusercontent.com/u/94514?v=3","gravatar_id":"","url":"https://api.github.com/users/dimagi","html_url":"https://github.com/dimagi","followers_url":"https://api.github.com/users/dimagi/followers","following_url":"https://api.github.com/users/dimagi/following{/other_user}","gists_url":"https://api.github.com/users/dimagi/gists{/gist_id}","starred_url":"https://api.github.com/users/dimagi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dimagi/subscriptions","organizations_url":"https://api.github.com/users/dimagi/orgs","repos_url":"https://api.github.com/users/dimagi/repos","events_url":"https://api.github.com/users/dimagi/events{/privacy}","received_events_url":"https://api.github.com/users/dimagi/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dimagi/commcare-hq","description":"A server-side tool to help manage community health workers, written in Django","fork":false,"url":"https://api.github.com/repos/dimagi/commcare-hq","forks_url":"https://api.github.com/repos/dimagi/commcare-hq/forks","keys_url":"https://api.github.com/repos/dimagi/commcare-hq/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dimagi/commcare-hq/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dimagi/commcare-hq/teams","hooks_url":"https://api.github.com/repos/dimagi/commcare-hq/hooks","issue_events_url":"https://api.github.com/repos/dimagi/commcare-hq/issues/events{/number}","events_url":"https://api.github.com/repos/dimagi/commcare-hq/events","assignees_url":"https://api.github.com/repos/dimagi/commcare-hq/assignees{/user}","branches_url":"https://api.github.com/repos/dimagi/commcare-hq/branches{/branch}","tags_url":"https://api.github.com/repos/dimagi/commcare-hq/tags","blobs_url":"https://api.github.com/repos/dimagi/commcare-hq/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dimagi/commcare-hq/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dimagi/commcare-hq/git/refs{/sha}","trees_url":"https://api.github.com/repos/dimagi/commcare-hq/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dimagi/commcare-hq/statuses/{sha}","languages_url":"https://api.github.com/repos/dimagi/commcare-hq/languages","stargazers_url":"https://api.github.com/repos/dimagi/commcare-hq/stargazers","contributors_url":"https://api.github.com/repos/dimagi/commcare-hq/contributors","subscribers_url":"https://api.github.com/repos/dimagi/commcare-hq/subscribers","subscription_url":"https://api.github.com/repos/dimagi/commcare-hq/subscription","commits_url":"https://api.github.com/repos/dimagi/commcare-hq/commits{/sha}","git_commits_url":"https://api.github.com/repos/dimagi/commcare-hq/git/commits{/sha}","comments_url":"https://api.github.com/repos/dimagi/commcare-hq/comments{/number}","issue_comment_url":"https://api.github.com/repos/dimagi/commcare-hq/issues/comments/{number}","contents_url":"https://api.github.com/repos/dimagi/commcare-hq/contents/{+path}","compare_url":"https://api.github.com/repos/dimagi/commcare-hq/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dimagi/commcare-hq/merges","archive_url":"https://api.github.com/repos/dimagi/commcare-hq/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dimagi/commcare-hq/downloads","issues_url":"https://api.github.com/repos/dimagi/commcare-hq/issues{/number}","pulls_url":"https://api.github.com/repos/dimagi/commcare-hq/pulls{/number}","milestones_url":"https://api.github.com/repos/dimagi/commcare-hq/milestones{/number}","notifications_url":"https://api.github.com/repos/dimagi/commcare-hq/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dimagi/commcare-hq/labels{/name}","releases_url":"https://api.github.com/repos/dimagi/commcare-hq/releases{/id}","created_at":"2009-07-09T17:00:07Z","updated_at":"2015-02-09T16:18:15Z","pushed_at":"2015-02-09T18:28:39Z","git_url":"git://github.com/dimagi/commcare-hq.git","ssh_url":"git@github.com:dimagi/commcare-hq.git","clone_url":"https://github.com/dimagi/commcare-hq.git","svn_url":"https://github.com/dimagi/commcare-hq","homepage":"http://www.commcarehq.org","size":197710,"stargazers_count":43,"watchers_count":43,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":57,"mirror_url":null,"open_issues_count":42,"forks":57,"open_issues":42,"watchers":43,"default_branch":"master"}},"base":{"label":"dimagi:master","ref":"master","sha":"f848e908e4497a03cad4d5db7be697aa83b8f185","user":{"login":"dimagi","id":94514,"avatar_url":"https://avatars.githubusercontent.com/u/94514?v=3","gravatar_id":"","url":"https://api.github.com/users/dimagi","html_url":"https://github.com/dimagi","followers_url":"https://api.github.com/users/dimagi/followers","following_url":"https://api.github.com/users/dimagi/following{/other_user}","gists_url":"https://api.github.com/users/dimagi/gists{/gist_id}","starred_url":"https://api.github.com/users/dimagi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dimagi/subscriptions","organizations_url":"https://api.github.com/users/dimagi/orgs","repos_url":"https://api.github.com/users/dimagi/repos","events_url":"https://api.github.com/users/dimagi/events{/privacy}","received_events_url":"https://api.github.com/users/dimagi/received_events","type":"Organization","site_admin":false},"repo":{"id":247278,"name":"commcare-hq","full_name":"dimagi/commcare-hq","owner":{"login":"dimagi","id":94514,"avatar_url":"https://avatars.githubusercontent.com/u/94514?v=3","gravatar_id":"","url":"https://api.github.com/users/dimagi","html_url":"https://github.com/dimagi","followers_url":"https://api.github.com/users/dimagi/followers","following_url":"https://api.github.com/users/dimagi/following{/other_user}","gists_url":"https://api.github.com/users/dimagi/gists{/gist_id}","starred_url":"https://api.github.com/users/dimagi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dimagi/subscriptions","organizations_url":"https://api.github.com/users/dimagi/orgs","repos_url":"https://api.github.com/users/dimagi/repos","events_url":"https://api.github.com/users/dimagi/events{/privacy}","received_events_url":"https://api.github.com/users/dimagi/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dimagi/commcare-hq","description":"A server-side tool to help manage community health workers, written in Django","fork":false,"url":"https://api.github.com/repos/dimagi/commcare-hq","forks_url":"https://api.github.com/repos/dimagi/commcare-hq/forks","keys_url":"https://api.github.com/repos/dimagi/commcare-hq/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dimagi/commcare-hq/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dimagi/commcare-hq/teams","hooks_url":"https://api.github.com/repos/dimagi/commcare-hq/hooks","issue_events_url":"https://api.github.com/repos/dimagi/commcare-hq/issues/events{/number}","events_url":"https://api.github.com/repos/dimagi/commcare-hq/events","assignees_url":"https://api.github.com/repos/dimagi/commcare-hq/assignees{/user}","branches_url":"https://api.github.com/repos/dimagi/commcare-hq/branches{/branch}","tags_url":"https://api.github.com/repos/dimagi/commcare-hq/tags","blobs_url":"https://api.github.com/repos/dimagi/commcare-hq/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dimagi/commcare-hq/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dimagi/commcare-hq/git/refs{/sha}","trees_url":"https://api.github.com/repos/dimagi/commcare-hq/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dimagi/commcare-hq/statuses/{sha}","languages_url":"https://api.github.com/repos/dimagi/commcare-hq/languages","stargazers_url":"https://api.github.com/repos/dimagi/commcare-hq/stargazers","contributors_url":"https://api.github.com/repos/dimagi/commcare-hq/contributors","subscribers_url":"https://api.github.com/repos/dimagi/commcare-hq/subscribers","subscription_url":"https://api.github.com/repos/dimagi/commcare-hq/subscription","commits_url":"https://api.github.com/repos/dimagi/commcare-hq/commits{/sha}","git_commits_url":"https://api.github.com/repos/dimagi/commcare-hq/git/commits{/sha}","comments_url":"https://api.github.com/repos/dimagi/commcare-hq/comments{/number}","issue_comment_url":"https://api.github.com/repos/dimagi/commcare-hq/issues/comments/{number}","contents_url":"https://api.github.com/repos/dimagi/commcare-hq/contents/{+path}","compare_url":"https://api.github.com/repos/dimagi/commcare-hq/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dimagi/commcare-hq/merges","archive_url":"https://api.github.com/repos/dimagi/commcare-hq/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dimagi/commcare-hq/downloads","issues_url":"https://api.github.com/repos/dimagi/commcare-hq/issues{/number}","pulls_url":"https://api.github.com/repos/dimagi/commcare-hq/pulls{/number}","milestones_url":"https://api.github.com/repos/dimagi/commcare-hq/milestones{/number}","notifications_url":"https://api.github.com/repos/dimagi/commcare-hq/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dimagi/commcare-hq/labels{/name}","releases_url":"https://api.github.com/repos/dimagi/commcare-hq/releases{/id}","created_at":"2009-07-09T17:00:07Z","updated_at":"2015-02-09T16:18:15Z","pushed_at":"2015-02-09T18:28:39Z","git_url":"git://github.com/dimagi/commcare-hq.git","ssh_url":"git@github.com:dimagi/commcare-hq.git","clone_url":"https://github.com/dimagi/commcare-hq.git","svn_url":"https://github.com/dimagi/commcare-hq","homepage":"http://www.commcarehq.org","size":197710,"stargazers_count":43,"watchers_count":43,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":57,"mirror_url":null,"open_issues_count":42,"forks":57,"open_issues":42,"watchers":43,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dimagi/commcare-hq/pulls/5489"},"html":{"href":"https://github.com/dimagi/commcare-hq/pull/5489"},"issue":{"href":"https://api.github.com/repos/dimagi/commcare-hq/issues/5489"},"comments":{"href":"https://api.github.com/repos/dimagi/commcare-hq/issues/5489/comments"},"review_comments":{"href":"https://api.github.com/repos/dimagi/commcare-hq/pulls/5489/comments"},"review_comment":{"href":"https://api.github.com/repos/dimagi/commcare-hq/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/dimagi/commcare-hq/pulls/5489/commits"},"statuses":{"href":"https://api.github.com/repos/dimagi/commcare-hq/statuses/60143408583daa273f8f482c1453d5bce6018d8e"}}}}