Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
course-discovery
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
course-discovery
Commits
39e63327
Commit
39e63327
authored
Jan 04, 2017
by
tasawernawaz
Committed by
Tasawer Nawaz
Jan 05, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
certificate type and price fields updated ECOM-6087
parent
47ff3865
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
83 additions
and
43 deletions
+83
-43
course_discovery/apps/publisher/forms.py
+21
-3
course_discovery/apps/publisher/tests/test_views.py
+6
-7
course_discovery/conf/locale/en/LC_MESSAGES/django.mo
+0
-0
course_discovery/conf/locale/en/LC_MESSAGES/django.po
+26
-7
course_discovery/conf/locale/en/LC_MESSAGES/djangojs.mo
+0
-0
course_discovery/conf/locale/en/LC_MESSAGES/djangojs.po
+1
-1
course_discovery/conf/locale/eo/LC_MESSAGES/django.mo
+0
-0
course_discovery/conf/locale/eo/LC_MESSAGES/django.po
+28
-9
course_discovery/conf/locale/eo/LC_MESSAGES/djangojs.mo
+0
-0
course_discovery/conf/locale/eo/LC_MESSAGES/djangojs.po
+1
-1
course_discovery/static/js/publisher/seat-type-change.js
+0
-15
No files found.
course_discovery/apps/publisher/forms.py
View file @
39e63327
...
@@ -201,9 +201,8 @@ class SeatForm(BaseCourseForm):
...
@@ -201,9 +201,8 @@ class SeatForm(BaseCourseForm):
price
=
self
.
cleaned_data
.
get
(
'price'
)
price
=
self
.
cleaned_data
.
get
(
'price'
)
seat_type
=
self
.
cleaned_data
.
get
(
'type'
)
seat_type
=
self
.
cleaned_data
.
get
(
'type'
)
if
seat_type
in
[
Seat
.
PROFESSIONAL
,
Seat
.
NO_ID_PROFESSIONAL
,
Seat
.
VERIFIED
,
Seat
.
CREDIT
]
\
if
seat_type
in
[
Seat
.
PROFESSIONAL
,
Seat
.
VERIFIED
]
and
not
price
:
and
not
price
:
self
.
add_error
(
'price'
,
_
(
'Only audit seat can be without price.'
))
self
.
add_error
(
'price'
,
_
(
'Only honor/audit seats can be without price.'
))
return
self
.
cleaned_data
return
self
.
cleaned_data
...
@@ -211,5 +210,24 @@ class SeatForm(BaseCourseForm):
...
@@ -211,5 +210,24 @@ class SeatForm(BaseCourseForm):
class
CustomSeatForm
(
SeatForm
):
class
CustomSeatForm
(
SeatForm
):
""" Course Seat Form. """
""" Course Seat Form. """
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
(
CustomSeatForm
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
field_classes
=
'field-input input-select'
if
'type'
in
self
.
errors
:
field_classes
=
'{} has-error'
.
format
(
field_classes
)
self
.
fields
[
'type'
]
.
widget
.
attrs
=
{
'class'
:
field_classes
}
TYPE_CHOICES
=
[
(
''
,
_
(
'Choose course type'
)),
(
Seat
.
AUDIT
,
_
(
'Audit Only'
)),
(
Seat
.
VERIFIED
,
_
(
'Verified Certificate'
)),
(
Seat
.
PROFESSIONAL
,
_
(
'Professional Education'
)),
]
type
=
forms
.
ChoiceField
(
choices
=
TYPE_CHOICES
,
required
=
True
,
label
=
_
(
'Seat Type'
))
class
Meta
(
SeatForm
.
Meta
):
class
Meta
(
SeatForm
.
Meta
):
fields
=
(
'price'
,
'type'
)
fields
=
(
'price'
,
'type'
)
course_discovery/apps/publisher/tests/test_views.py
View file @
39e63327
...
@@ -218,7 +218,7 @@ class CreateUpdateCourseViewTests(TestCase):
...
@@ -218,7 +218,7 @@ class CreateUpdateCourseViewTests(TestCase):
self
.
assertContains
(
response
,
'Add new comment'
)
self
.
assertContains
(
response
,
'Add new comment'
)
self
.
assertContains
(
response
,
comment
.
comment
)
self
.
assertContains
(
response
,
comment
.
comment
)
@ddt.data
(
Seat
.
VERIFIED
,
Seat
.
PROFESSIONAL
,
Seat
.
NO_ID_PROFESSIONAL
,
Seat
.
CREDIT
)
@ddt.data
(
Seat
.
VERIFIED
,
Seat
.
PROFESSIONAL
)
def
test_create_course_without_price_with_error
(
self
,
seat_type
):
def
test_create_course_without_price_with_error
(
self
,
seat_type
):
""" Verify that if seat type is not honor/audit then price should be given.
""" Verify that if seat type is not honor/audit then price should be given.
Otherwise it will throw error.
Otherwise it will throw error.
...
@@ -231,22 +231,21 @@ class CreateUpdateCourseViewTests(TestCase):
...
@@ -231,22 +231,21 @@ class CreateUpdateCourseViewTests(TestCase):
response
=
self
.
client
.
post
(
reverse
(
'publisher:publisher_courses_new'
),
course_dict
,
files
=
data
[
'image'
])
response
=
self
.
client
.
post
(
reverse
(
'publisher:publisher_courses_new'
),
course_dict
,
files
=
data
[
'image'
])
self
.
assertEqual
(
response
.
status_code
,
400
)
self
.
assertEqual
(
response
.
status_code
,
400
)
self
.
assertEqual
(
self
.
assertEqual
(
response
.
context
[
'seat_form'
]
.
errors
[
'price'
][
0
],
'Only
honor/audit seats
can be without price.'
response
.
context
[
'seat_form'
]
.
errors
[
'price'
][
0
],
'Only
audit seat
can be without price.'
)
)
self
.
_assert_records
(
1
)
self
.
_assert_records
(
1
)
@ddt.data
(
Seat
.
AUDIT
,
Seat
.
HONOR
)
def
test_create_course_without_price_with_success
(
self
):
def
test_create_course_without_price_with_success
(
self
,
seat_type
):
""" Verify that if seat type is audit then price is not required. """
""" Verify that if seat type is honor/audit then price is not required. """
self
.
user
.
groups
.
add
(
Group
.
objects
.
get
(
name
=
ADMIN_GROUP_NAME
))
self
.
user
.
groups
.
add
(
Group
.
objects
.
get
(
name
=
ADMIN_GROUP_NAME
))
self
.
_assert_records
(
1
)
self
.
_assert_records
(
1
)
data
=
{
'number'
:
'course_1'
,
'image'
:
''
}
data
=
{
'number'
:
'course_1'
,
'image'
:
''
}
course_dict
=
self
.
_post_data
(
data
,
self
.
course
,
self
.
course_run
,
self
.
seat
)
course_dict
=
self
.
_post_data
(
data
,
self
.
course
,
self
.
course_run
,
self
.
seat
)
course_dict
[
'price'
]
=
0
course_dict
[
'price'
]
=
0
course_dict
[
'type'
]
=
seat_type
course_dict
[
'type'
]
=
Seat
.
AUDIT
response
=
self
.
client
.
post
(
reverse
(
'publisher:publisher_courses_new'
),
course_dict
,
files
=
data
[
'image'
])
response
=
self
.
client
.
post
(
reverse
(
'publisher:publisher_courses_new'
),
course_dict
,
files
=
data
[
'image'
])
course
=
Course
.
objects
.
get
(
number
=
data
[
'number'
])
course
=
Course
.
objects
.
get
(
number
=
data
[
'number'
])
self
.
_assert_test_data
(
response
,
course
,
seat_type
,
0
)
self
.
_assert_test_data
(
response
,
course
,
Seat
.
AUDIT
,
0
)
def
test_create_form_with_single_organization
(
self
):
def
test_create_form_with_single_organization
(
self
):
"""Verify that if there is only one organization then that organization will be shown as text. """
"""Verify that if there is only one organization then that organization will be shown as text. """
...
...
course_discovery/conf/locale/en/LC_MESSAGES/django.mo
View file @
39e63327
No preview for this file type
course_discovery/conf/locale/en/LC_MESSAGES/django.po
View file @
39e63327
...
@@ -7,7 +7,7 @@ msgid ""
...
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-01-0
4
12:31+0500\n"
"POT-Creation-Date: 2017-01-0
5
12:31+0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
...
@@ -477,7 +477,28 @@ msgid "Pace"
...
@@ -477,7 +477,28 @@ msgid "Pace"
msgstr ""
msgstr ""
#: apps/publisher/forms.py
#: apps/publisher/forms.py
msgid "Only honor/audit seats can be without price."
msgid "Only audit seat can be without price."
msgstr ""
#: apps/publisher/forms.py
msgid "Choose course type"
msgstr ""
#: apps/publisher/forms.py
msgid "Audit Only"
msgstr ""
#: apps/publisher/forms.py
msgid "Verified Certificate"
msgstr ""
#: apps/publisher/forms.py
msgid "Professional Education"
msgstr ""
#: apps/publisher/forms.py templates/publisher/add_course_form.html
#: templates/publisher/course_run_detail/_seats.html
msgid "Seat Type"
msgstr ""
msgstr ""
#: apps/publisher/models.py
#: apps/publisher/models.py
...
@@ -936,11 +957,6 @@ msgid "About page information"
...
@@ -936,11 +957,6 @@ msgid "About page information"
msgstr ""
msgstr ""
#: templates/publisher/add_course_form.html
#: templates/publisher/add_course_form.html
#: templates/publisher/course_run_detail/_seats.html
msgid "Seat Type"
msgstr ""
#: templates/publisher/add_course_form.html
msgid ""
msgid ""
"Reads as a tag line - a short, engaging description for students browsing "
"Reads as a tag line - a short, engaging description for students browsing "
"course listings"
"course listings"
...
@@ -1869,14 +1885,17 @@ msgid ""
...
@@ -1869,14 +1885,17 @@ msgid ""
msgstr ""
msgstr ""
#: templates/publisher/email/studio_instance_needed.html
#: templates/publisher/email/studio_instance_needed.html
#: templates/publisher/email/studio_instance_needed.txt
msgid "Dear"
msgid "Dear"
msgstr ""
msgstr ""
#: templates/publisher/email/studio_instance_needed.html
#: templates/publisher/email/studio_instance_needed.html
#: templates/publisher/email/studio_instance_needed.txt
msgid "Please create a Studio instance for the following course."
msgid "Please create a Studio instance for the following course."
msgstr ""
msgstr ""
#: templates/publisher/email/studio_instance_needed.html
#: templates/publisher/email/studio_instance_needed.html
#: templates/publisher/email/studio_instance_needed.txt
msgid "Thanks,"
msgid "Thanks,"
msgstr ""
msgstr ""
...
...
course_discovery/conf/locale/en/LC_MESSAGES/djangojs.mo
View file @
39e63327
No preview for this file type
course_discovery/conf/locale/en/LC_MESSAGES/djangojs.po
View file @
39e63327
...
@@ -7,7 +7,7 @@ msgid ""
...
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-01-0
4
12:31+0500\n"
"POT-Creation-Date: 2017-01-0
5
12:31+0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
...
...
course_discovery/conf/locale/eo/LC_MESSAGES/django.mo
View file @
39e63327
No preview for this file type
course_discovery/conf/locale/eo/LC_MESSAGES/django.po
View file @
39e63327
...
@@ -7,7 +7,7 @@ msgid ""
...
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-01-0
4
12:31+0500\n"
"POT-Creation-Date: 2017-01-0
5
12:31+0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
...
@@ -585,10 +585,31 @@ msgid "Pace"
...
@@ -585,10 +585,31 @@ msgid "Pace"
msgstr "Päçé Ⱡ'σяєм ι#"
msgstr "Päçé Ⱡ'σяєм ι#"
#: apps/publisher/forms.py
#: apps/publisher/forms.py
msgid "Only
honor/audit seats
can be without price."
msgid "Only
audit seat
can be without price."
msgstr ""
msgstr ""
"Önlý hönör/äüdït séäts çän ßé wïthöüt prïçé. Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмєт, "
"Önlý äüdït séät çän ßé wïthöüt prïçé. Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмєт, "
"¢σηѕє¢тєтυя #"
"¢σηѕє¢тєтυ#"
#: apps/publisher/forms.py
msgid "Choose course type"
msgstr "Çhöösé çöürsé týpé Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмєт#"
#: apps/publisher/forms.py
msgid "Audit Only"
msgstr "Àüdït Önlý Ⱡ'σяєм ιρѕυм ∂σłσ#"
#: apps/publisher/forms.py
msgid "Verified Certificate"
msgstr "Vérïfïéd Çértïfïçäté Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмєт, #"
#: apps/publisher/forms.py
msgid "Professional Education"
msgstr "Pröféssïönäl Édüçätïön Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмєт, ¢#"
#: apps/publisher/forms.py templates/publisher/add_course_form.html
#: templates/publisher/course_run_detail/_seats.html
msgid "Seat Type"
msgstr "Séät Týpé Ⱡ'σяєм ιρѕυм ∂σł#"
#: apps/publisher/models.py
#: apps/publisher/models.py
msgid "Draft"
msgid "Draft"
...
@@ -1110,11 +1131,6 @@ msgid "About page information"
...
@@ -1110,11 +1131,6 @@ msgid "About page information"
msgstr "Àßöüt pägé ïnförmätïön Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмєт, ¢#"
msgstr "Àßöüt pägé ïnförmätïön Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмєт, ¢#"
#: templates/publisher/add_course_form.html
#: templates/publisher/add_course_form.html
#: templates/publisher/course_run_detail/_seats.html
msgid "Seat Type"
msgstr "Séät Týpé Ⱡ'σяєм ιρѕυм ∂σł#"
#: templates/publisher/add_course_form.html
msgid ""
msgid ""
"Reads as a tag line - a short, engaging description for students browsing "
"Reads as a tag line - a short, engaging description for students browsing "
"course listings"
"course listings"
...
@@ -2185,16 +2201,19 @@ msgstr ""
...
@@ -2185,16 +2201,19 @@ msgstr ""
"%(course_run_page_url)s Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмєт, ¢σηѕє¢тєтυя α#"
"%(course_run_page_url)s Ⱡ'σяєм ιρѕυм ∂σłσя ѕιт αмєт, ¢σηѕє¢тєтυя α#"
#: templates/publisher/email/studio_instance_needed.html
#: templates/publisher/email/studio_instance_needed.html
#: templates/publisher/email/studio_instance_needed.txt
msgid "Dear"
msgid "Dear"
msgstr "Déär Ⱡ'σяєм ι#"
msgstr "Déär Ⱡ'σяєм ι#"
#: templates/publisher/email/studio_instance_needed.html
#: templates/publisher/email/studio_instance_needed.html
#: templates/publisher/email/studio_instance_needed.txt
msgid "Please create a Studio instance for the following course."
msgid "Please create a Studio instance for the following course."
msgstr ""
msgstr ""
"Pléäsé çréäté ä Stüdïö ïnstänçé för thé föllöwïng çöürsé. Ⱡ'σяєм ιρѕυм ∂σłσя"
"Pléäsé çréäté ä Stüdïö ïnstänçé för thé föllöwïng çöürsé. Ⱡ'σяєм ιρѕυм ∂σłσя"
" ѕιт αмєт, ¢σηѕє¢тєтυя α#"
" ѕιт αмєт, ¢σηѕє¢тєтυя α#"
#: templates/publisher/email/studio_instance_needed.html
#: templates/publisher/email/studio_instance_needed.html
#: templates/publisher/email/studio_instance_needed.txt
msgid "Thanks,"
msgid "Thanks,"
msgstr "Thänks, Ⱡ'σяєм ιρѕυм #"
msgstr "Thänks, Ⱡ'σяєм ιρѕυм #"
...
...
course_discovery/conf/locale/eo/LC_MESSAGES/djangojs.mo
View file @
39e63327
No preview for this file type
course_discovery/conf/locale/eo/LC_MESSAGES/djangojs.po
View file @
39e63327
...
@@ -7,7 +7,7 @@ msgid ""
...
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-01-0
4
12:31+0500\n"
"POT-Creation-Date: 2017-01-0
5
12:31+0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
...
...
course_discovery/static/js/publisher/seat-type-change.js
View file @
39e63327
...
@@ -4,8 +4,6 @@ $(function () {
...
@@ -4,8 +4,6 @@ $(function () {
hide_verified_fields
,
hide_verified_fields
,
show_professional_fields
,
show_professional_fields
,
hide_professional_fields
,
hide_professional_fields
,
show_credit_fields
,
hide_credit_fields
,
hide_all_fields
,
hide_all_fields
,
change_fields
;
change_fields
;
...
@@ -25,18 +23,9 @@ $(function () {
...
@@ -25,18 +23,9 @@ $(function () {
$
(
'#id_price'
).
prop
(
"readonly"
,
true
).
val
(
'0.00'
);
$
(
'#id_price'
).
prop
(
"readonly"
,
true
).
val
(
'0.00'
);
};
};
show_credit_fields
=
function
()
{
show_verified_fields
();
};
hide_credit_fields
=
function
()
{
hide_verified_fields
();
};
hide_all_fields
=
function
()
{
hide_all_fields
=
function
()
{
hide_verified_fields
();
hide_verified_fields
();
hide_professional_fields
();
hide_professional_fields
();
hide_credit_fields
()
};
};
change_fields
=
function
(
select_tag
)
{
change_fields
=
function
(
select_tag
)
{
...
@@ -52,10 +41,6 @@ $(function () {
...
@@ -52,10 +41,6 @@ $(function () {
hide_all_fields
();
hide_all_fields
();
show_professional_fields
();
show_professional_fields
();
}
}
else
if
(
selected_value
===
'credit'
)
{
hide_all_fields
();
show_credit_fields
();
}
else
{
else
{
hide_all_fields
();
hide_all_fields
();
}
}
...
...
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