Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
60de9ba2
Commit
60de9ba2
authored
Sep 19, 2014
by
Chris Dodge
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
be sure to constrain the select to the course_id that is being delete
wip
parent
c9357985
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
6 deletions
+10
-6
lms/djangoapps/shoppingcart/views.py
+10
-6
No files found.
lms/djangoapps/shoppingcart/views.py
View file @
60de9ba2
...
@@ -24,6 +24,7 @@ from .exceptions import ItemAlreadyInCartException, AlreadyEnrolledInCourseExcep
...
@@ -24,6 +24,7 @@ from .exceptions import ItemAlreadyInCartException, AlreadyEnrolledInCourseExcep
from
.models
import
Order
,
PaidCourseRegistration
,
OrderItem
,
Coupon
,
CouponRedemption
,
CourseRegistrationCode
,
RegistrationCodeRedemption
from
.models
import
Order
,
PaidCourseRegistration
,
OrderItem
,
Coupon
,
CouponRedemption
,
CourseRegistrationCode
,
RegistrationCodeRedemption
from
.processors
import
process_postpay_callback
,
render_purchase_form_html
from
.processors
import
process_postpay_callback
,
render_purchase_form_html
import
json
import
json
from
xmodule_django.models
import
CourseKeyField
log
=
logging
.
getLogger
(
"shoppingcart"
)
log
=
logging
.
getLogger
(
"shoppingcart"
)
AUDIT_LOG
=
logging
.
getLogger
(
"audit"
)
AUDIT_LOG
=
logging
.
getLogger
(
"audit"
)
...
@@ -132,7 +133,14 @@ def remove_code_redemption(order_item_course_id, item_id, item, user):
...
@@ -132,7 +133,14 @@ def remove_code_redemption(order_item_course_id, item_id, item, user):
"""
"""
try
:
try
:
# Try to remove redemption information of coupon code, If exist.
# Try to remove redemption information of coupon code, If exist.
coupon_redemption
=
CouponRedemption
.
objects
.
get
(
user
=
user
,
order
=
item
.
order_id
)
coupon_redemption
=
CouponRedemption
.
objects
.
get
(
user
=
user
,
coupon__course_id
=
order_item_course_id
if
order_item_course_id
else
CourseKeyField
.
Empty
,
order
=
item
.
order_id
)
coupon_redemption
.
delete
()
log
.
info
(
'Coupon "{0}" redemption entry removed for user "{1}" for order item "{2}"'
.
format
(
coupon_redemption
.
coupon
.
code
,
user
,
item_id
))
except
CouponRedemption
.
DoesNotExist
:
except
CouponRedemption
.
DoesNotExist
:
try
:
try
:
# Try to remove redemption information of registration code, If exist.
# Try to remove redemption information of registration code, If exist.
...
@@ -144,11 +152,7 @@ def remove_code_redemption(order_item_course_id, item_id, item, user):
...
@@ -144,11 +152,7 @@ def remove_code_redemption(order_item_course_id, item_id, item, user):
reg_code_redemption
.
delete
()
reg_code_redemption
.
delete
()
log
.
info
(
'Registration code "{0}" redemption entry removed for user "{1}" for order item "{2}"'
log
.
info
(
'Registration code "{0}" redemption entry removed for user "{1}" for order item "{2}"'
.
format
(
reg_code_redemption
.
registration_code
.
code
,
user
,
item_id
))
.
format
(
reg_code_redemption
.
registration_code
.
code
,
user
,
item_id
))
else
:
if
order_item_course_id
==
coupon_redemption
.
coupon
.
course_id
:
coupon_redemption
.
delete
()
log
.
info
(
'Coupon "{0}" redemption entry removed for user "{1}" for order item "{2}"'
.
format
(
coupon_redemption
.
coupon
.
code
,
user
,
item_id
))
@login_required
@login_required
def
use_code
(
request
):
def
use_code
(
request
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment