{"action":"created","comment":{"url":"https://api.github.com/repos/edx/ecommerce/pulls/comments/46471873","id":46471873,"diff_hunk":"@@ -0,0 +1,20 @@\n+# noinspection PyUnresolvedReferences\n+from django.db import models\n+from oscar.apps.offer.abstract_models import AbstractRange\n+\n+\n+class Range(AbstractRange):\n+    catalog = models.ForeignKey('catalogue.Catalog', blank=True, null=True, related_name='ranges')\n+\n+    def contains_product(self, product):\n+        if self.catalog:\n+            return product.id in self.catalog.stock_records.values_list('product', flat=True)","path":"ecommerce/extensions/offer/models.py","position":11,"original_position":11,"commit_id":"d8bd9ad25192e79333ffaaf9913ff06dee6641f1","original_commit_id":"d8bd9ad25192e79333ffaaf9913ff06dee6641f1","user":{"login":"clintonb","id":910510,"avatar_url":"https://avatars.githubusercontent.com/u/910510?v=3","gravatar_id":"","url":"https://api.github.com/users/clintonb","html_url":"https://github.com/clintonb","followers_url":"https://api.github.com/users/clintonb/followers","following_url":"https://api.github.com/users/clintonb/following{/other_user}","gists_url":"https://api.github.com/users/clintonb/gists{/gist_id}","starred_url":"https://api.github.com/users/clintonb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clintonb/subscriptions","organizations_url":"https://api.github.com/users/clintonb/orgs","repos_url":"https://api.github.com/users/clintonb/repos","events_url":"https://api.github.com/users/clintonb/events{/privacy}","received_events_url":"https://api.github.com/users/clintonb/received_events","type":"User","site_admin":false},"body":"This should be an `or` with the super value. A `Range` should be still be able to function as normal even if it has a catalog.","created_at":"2015-12-02T20:39:28Z","updated_at":"2015-12-02T20:39:28Z","html_url":"https://github.com/edx/ecommerce/pull/450#discussion_r46471873","pull_request_url":"https://api.github.com/repos/edx/ecommerce/pulls/450","_links":{"self":{"href":"https://api.github.com/repos/edx/ecommerce/pulls/comments/46471873"},"html":{"href":"https://github.com/edx/ecommerce/pull/450#discussion_r46471873"},"pull_request":{"href":"https://api.github.com/repos/edx/ecommerce/pulls/450"}}},"pull_request":{"url":"https://api.github.com/repos/edx/ecommerce/pulls/450","id":52371085,"html_url":"https://github.com/edx/ecommerce/pull/450","diff_url":"https://github.com/edx/ecommerce/pull/450.diff","patch_url":"https://github.com/edx/ecommerce/pull/450.patch","issue_url":"https://api.github.com/repos/edx/ecommerce/issues/450","number":450,"state":"open","locked":false,"title":"Voucher creation and generation of the CSV voucher report","user":{"login":"marjev","id":6833568,"avatar_url":"https://avatars.githubusercontent.com/u/6833568?v=3","gravatar_id":"","url":"https://api.github.com/users/marjev","html_url":"https://github.com/marjev","followers_url":"https://api.github.com/users/marjev/followers","following_url":"https://api.github.com/users/marjev/following{/other_user}","gists_url":"https://api.github.com/users/marjev/gists{/gist_id}","starred_url":"https://api.github.com/users/marjev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marjev/subscriptions","organizations_url":"https://api.github.com/users/marjev/orgs","repos_url":"https://api.github.com/users/marjev/repos","events_url":"https://api.github.com/users/marjev/events{/privacy}","received_events_url":"https://api.github.com/users/marjev/received_events","type":"User","site_admin":false},"body":"@clintonb, please review this PR. This is related to [SOL-1327](https://openedx.atlassian.net/browse/SOL-1327).\r\n\r\nHere's the list of changes this PR introduces:\r\n- Voucher creation (Range, Benefit, Condition and ConditionOffer are created under the hood)\r\n- Tests that Voucher creation works as expected\r\n- Test that Voucher usage works as expected (I wanted to make sure that applying a voucher to a basket containing a seat product works -- applies the benefit linked to a voucher)\r\n- Voucher report generation in *.csv format\r\n- Test that voucher report is formatted as expected\r\n\r\nThis work is continuation of work done by @vkaracic and @mjfrey. You'll see some changes to the lines merged by the first PR. Those are mostly replacements of `enrollment code` with `coupon`, since that's the new term we are using. Please notice the migration `0013_coupon_product_class.py`. It contains the reversal method that will should revert the changes introduced in `0012_enrollment_code_product_class`.\r\n\r\nIf you have any questions, please let me know.\r\nThanks!","created_at":"2015-12-02T09:26:24Z","updated_at":"2015-12-02T20:39:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7dc462e7f23f8e101aeec2b4f7e68cde0d23a2dc","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/edx/ecommerce/pulls/450/commits","review_comments_url":"https://api.github.com/repos/edx/ecommerce/pulls/450/comments","review_comment_url":"https://api.github.com/repos/edx/ecommerce/pulls/comments{/number}","comments_url":"https://api.github.com/repos/edx/ecommerce/issues/450/comments","statuses_url":"https://api.github.com/repos/edx/ecommerce/statuses/d8bd9ad25192e79333ffaaf9913ff06dee6641f1","head":{"label":"vkaracic:mjevtic/SOL-1327","ref":"mjevtic/SOL-1327","sha":"d8bd9ad25192e79333ffaaf9913ff06dee6641f1","user":{"login":"vkaracic","id":2808092,"avatar_url":"https://avatars.githubusercontent.com/u/2808092?v=3","gravatar_id":"","url":"https://api.github.com/users/vkaracic","html_url":"https://github.com/vkaracic","followers_url":"https://api.github.com/users/vkaracic/followers","following_url":"https://api.github.com/users/vkaracic/following{/other_user}","gists_url":"https://api.github.com/users/vkaracic/gists{/gist_id}","starred_url":"https://api.github.com/users/vkaracic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vkaracic/subscriptions","organizations_url":"https://api.github.com/users/vkaracic/orgs","repos_url":"https://api.github.com/users/vkaracic/repos","events_url":"https://api.github.com/users/vkaracic/events{/privacy}","received_events_url":"https://api.github.com/users/vkaracic/received_events","type":"User","site_admin":false},"repo":{"id":44113047,"name":"ecommerce","full_name":"vkaracic/ecommerce","owner":{"login":"vkaracic","id":2808092,"avatar_url":"https://avatars.githubusercontent.com/u/2808092?v=3","gravatar_id":"","url":"https://api.github.com/users/vkaracic","html_url":"https://github.com/vkaracic","followers_url":"https://api.github.com/users/vkaracic/followers","following_url":"https://api.github.com/users/vkaracic/following{/other_user}","gists_url":"https://api.github.com/users/vkaracic/gists{/gist_id}","starred_url":"https://api.github.com/users/vkaracic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vkaracic/subscriptions","organizations_url":"https://api.github.com/users/vkaracic/orgs","repos_url":"https://api.github.com/users/vkaracic/repos","events_url":"https://api.github.com/users/vkaracic/events{/privacy}","received_events_url":"https://api.github.com/users/vkaracic/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/vkaracic/ecommerce","description":"Django application used to manage edX's product catalog and handle orders for those products","fork":true,"url":"https://api.github.com/repos/vkaracic/ecommerce","forks_url":"https://api.github.com/repos/vkaracic/ecommerce/forks","keys_url":"https://api.github.com/repos/vkaracic/ecommerce/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vkaracic/ecommerce/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vkaracic/ecommerce/teams","hooks_url":"https://api.github.com/repos/vkaracic/ecommerce/hooks","issue_events_url":"https://api.github.com/repos/vkaracic/ecommerce/issues/events{/number}","events_url":"https://api.github.com/repos/vkaracic/ecommerce/events","assignees_url":"https://api.github.com/repos/vkaracic/ecommerce/assignees{/user}","branches_url":"https://api.github.com/repos/vkaracic/ecommerce/branches{/branch}","tags_url":"https://api.github.com/repos/vkaracic/ecommerce/tags","blobs_url":"https://api.github.com/repos/vkaracic/ecommerce/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vkaracic/ecommerce/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vkaracic/ecommerce/git/refs{/sha}","trees_url":"https://api.github.com/repos/vkaracic/ecommerce/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vkaracic/ecommerce/statuses/{sha}","languages_url":"https://api.github.com/repos/vkaracic/ecommerce/languages","stargazers_url":"https://api.github.com/repos/vkaracic/ecommerce/stargazers","contributors_url":"https://api.github.com/repos/vkaracic/ecommerce/contributors","subscribers_url":"https://api.github.com/repos/vkaracic/ecommerce/subscribers","subscription_url":"https://api.github.com/repos/vkaracic/ecommerce/subscription","commits_url":"https://api.github.com/repos/vkaracic/ecommerce/commits{/sha}","git_commits_url":"https://api.github.com/repos/vkaracic/ecommerce/git/commits{/sha}","comments_url":"https://api.github.com/repos/vkaracic/ecommerce/comments{/number}","issue_comment_url":"https://api.github.com/repos/vkaracic/ecommerce/issues/comments{/number}","contents_url":"https://api.github.com/repos/vkaracic/ecommerce/contents/{+path}","compare_url":"https://api.github.com/repos/vkaracic/ecommerce/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vkaracic/ecommerce/merges","archive_url":"https://api.github.com/repos/vkaracic/ecommerce/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vkaracic/ecommerce/downloads","issues_url":"https://api.github.com/repos/vkaracic/ecommerce/issues{/number}","pulls_url":"https://api.github.com/repos/vkaracic/ecommerce/pulls{/number}","milestones_url":"https://api.github.com/repos/vkaracic/ecommerce/milestones{/number}","notifications_url":"https://api.github.com/repos/vkaracic/ecommerce/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vkaracic/ecommerce/labels{/name}","releases_url":"https://api.github.com/repos/vkaracic/ecommerce/releases{/id}","created_at":"2015-10-12T14:37:27Z","updated_at":"2015-10-12T14:37:29Z","pushed_at":"2015-12-02T15:37:31Z","git_url":"git://github.com/vkaracic/ecommerce.git","ssh_url":"git@github.com:vkaracic/ecommerce.git","clone_url":"https://github.com/vkaracic/ecommerce.git","svn_url":"https://github.com/vkaracic/ecommerce","homepage":"","size":8359,"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":"edx:master","ref":"master","sha":"91be84ff6e98ca2dd01470919a47796d8f5ab6fd","user":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"repo":{"id":30175039,"name":"ecommerce","full_name":"edx/ecommerce","owner":{"login":"edx","id":3179841,"avatar_url":"https://avatars.githubusercontent.com/u/3179841?v=3","gravatar_id":"","url":"https://api.github.com/users/edx","html_url":"https://github.com/edx","followers_url":"https://api.github.com/users/edx/followers","following_url":"https://api.github.com/users/edx/following{/other_user}","gists_url":"https://api.github.com/users/edx/gists{/gist_id}","starred_url":"https://api.github.com/users/edx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edx/subscriptions","organizations_url":"https://api.github.com/users/edx/orgs","repos_url":"https://api.github.com/users/edx/repos","events_url":"https://api.github.com/users/edx/events{/privacy}","received_events_url":"https://api.github.com/users/edx/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/edx/ecommerce","description":"Django application used to manage edX's product catalog and handle orders for those products","fork":false,"url":"https://api.github.com/repos/edx/ecommerce","forks_url":"https://api.github.com/repos/edx/ecommerce/forks","keys_url":"https://api.github.com/repos/edx/ecommerce/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edx/ecommerce/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edx/ecommerce/teams","hooks_url":"https://api.github.com/repos/edx/ecommerce/hooks","issue_events_url":"https://api.github.com/repos/edx/ecommerce/issues/events{/number}","events_url":"https://api.github.com/repos/edx/ecommerce/events","assignees_url":"https://api.github.com/repos/edx/ecommerce/assignees{/user}","branches_url":"https://api.github.com/repos/edx/ecommerce/branches{/branch}","tags_url":"https://api.github.com/repos/edx/ecommerce/tags","blobs_url":"https://api.github.com/repos/edx/ecommerce/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edx/ecommerce/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edx/ecommerce/git/refs{/sha}","trees_url":"https://api.github.com/repos/edx/ecommerce/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edx/ecommerce/statuses/{sha}","languages_url":"https://api.github.com/repos/edx/ecommerce/languages","stargazers_url":"https://api.github.com/repos/edx/ecommerce/stargazers","contributors_url":"https://api.github.com/repos/edx/ecommerce/contributors","subscribers_url":"https://api.github.com/repos/edx/ecommerce/subscribers","subscription_url":"https://api.github.com/repos/edx/ecommerce/subscription","commits_url":"https://api.github.com/repos/edx/ecommerce/commits{/sha}","git_commits_url":"https://api.github.com/repos/edx/ecommerce/git/commits{/sha}","comments_url":"https://api.github.com/repos/edx/ecommerce/comments{/number}","issue_comment_url":"https://api.github.com/repos/edx/ecommerce/issues/comments{/number}","contents_url":"https://api.github.com/repos/edx/ecommerce/contents/{+path}","compare_url":"https://api.github.com/repos/edx/ecommerce/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edx/ecommerce/merges","archive_url":"https://api.github.com/repos/edx/ecommerce/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edx/ecommerce/downloads","issues_url":"https://api.github.com/repos/edx/ecommerce/issues{/number}","pulls_url":"https://api.github.com/repos/edx/ecommerce/pulls{/number}","milestones_url":"https://api.github.com/repos/edx/ecommerce/milestones{/number}","notifications_url":"https://api.github.com/repos/edx/ecommerce/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edx/ecommerce/labels{/name}","releases_url":"https://api.github.com/repos/edx/ecommerce/releases{/id}","created_at":"2015-02-02T06:55:15Z","updated_at":"2015-12-02T03:06:44Z","pushed_at":"2015-12-02T20:26:42Z","git_url":"git://github.com/edx/ecommerce.git","ssh_url":"git@github.com:edx/ecommerce.git","clone_url":"https://github.com/edx/ecommerce.git","svn_url":"https://github.com/edx/ecommerce","homepage":"http://open-edx-ecommerce-guide.readthedocs.org","size":8491,"stargazers_count":18,"watchers_count":18,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":18,"mirror_url":null,"open_issues_count":9,"forks":18,"open_issues":9,"watchers":18,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/edx/ecommerce/pulls/450"},"html":{"href":"https://github.com/edx/ecommerce/pull/450"},"issue":{"href":"https://api.github.com/repos/edx/ecommerce/issues/450"},"comments":{"href":"https://api.github.com/repos/edx/ecommerce/issues/450/comments"},"review_comments":{"href":"https://api.github.com/repos/edx/ecommerce/pulls/450/comments"},"review_comment":{"href":"https://api.github.com/repos/edx/ecommerce/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/edx/ecommerce/pulls/450/commits"},"statuses":{"href":"https://api.github.com/repos/edx/ecommerce/statuses/d8bd9ad25192e79333ffaaf9913ff06dee6641f1"}}}}