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
7be1f310
Commit
7be1f310
authored
Jul 25, 2017
by
Matthew Piatetsky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add utm params to url redirect
LEARNER-2016
parent
f625e032
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
0 deletions
+18
-0
lms/djangoapps/verify_student/views.py
+18
-0
No files found.
lms/djangoapps/verify_student/views.py
View file @
7be1f310
...
...
@@ -6,6 +6,7 @@ import datetime
import
decimal
import
json
import
logging
import
urllib
import
analytics
import
waffle
...
...
@@ -434,6 +435,21 @@ class PayAndVerifyView(View):
return
render_to_response
(
"verify_student/pay_and_verify.html"
,
context
)
def
add_utm_params_to_url
(
self
,
url
):
# utm_params is [(u'utm_content', u'course-v1:IDBx IDB20.1x 1T2017'),...
utm_params
=
[
item
for
item
in
self
.
request
.
GET
.
items
()
if
'utm_'
in
item
[
0
]]
# utm_params is utm_content=course-v1%3AIDBx+IDB20.1x+1T2017&...
utm_params
=
urllib
.
urlencode
(
utm_params
,
True
)
# utm_params is utm_content=course-v1:IDBx+IDB20.1x+1T2017&...
# (course-keys do not have url encoding)
utm_params
=
urllib
.
unquote
(
utm_params
)
if
utm_params
:
if
'?'
in
url
:
url
=
url
+
'&'
+
utm_params
else
:
url
=
url
+
'?'
+
utm_params
return
url
def
_redirect_if_necessary
(
self
,
message
,
already_verified
,
already_paid
,
is_enrolled
,
course_key
,
# pylint: disable=bad-continuation
user_is_trying_to_pay
,
user
,
sku
# pylint: disable=bad-continuation
...
...
@@ -504,6 +520,8 @@ class PayAndVerifyView(View):
# Redirect if necessary, otherwise implicitly return None
if
url
is
not
None
:
if
waffle
.
switch_is_active
(
'add-utm-params'
):
url
=
self
.
add_utm_params_to_url
(
url
)
return
redirect
(
url
)
def
_get_paid_mode
(
self
,
course_key
):
...
...
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