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
7b05eeda
Commit
7b05eeda
authored
May 08, 2017
by
Asad Azam
Committed by
AsadAzam
May 09, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minimum effort and maximum effort field validations
parent
35c63876
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
39 additions
and
8 deletions
+39
-8
course_discovery/apps/publisher/forms.py
+9
-0
course_discovery/apps/publisher/tests/test_forms.py
+19
-0
course_discovery/conf/locale/en/LC_MESSAGES/django.mo
+0
-0
course_discovery/conf/locale/en/LC_MESSAGES/django.po
+2
-2
course_discovery/conf/locale/en/LC_MESSAGES/djangojs.mo
+0
-0
course_discovery/conf/locale/en/LC_MESSAGES/djangojs.po
+2
-2
course_discovery/conf/locale/eo/LC_MESSAGES/django.mo
+0
-0
course_discovery/conf/locale/eo/LC_MESSAGES/django.po
+2
-2
course_discovery/conf/locale/eo/LC_MESSAGES/djangojs.mo
+0
-0
course_discovery/conf/locale/eo/LC_MESSAGES/djangojs.po
+2
-2
course_discovery/templates/publisher/course_run/edit_run_form.html
+3
-0
No files found.
course_discovery/apps/publisher/forms.py
View file @
7b05eeda
...
...
@@ -302,6 +302,15 @@ class CustomCourseRunForm(CourseRunForm):
return
None
def
clean
(
self
):
cleaned_data
=
self
.
cleaned_data
min_effort
=
cleaned_data
.
get
(
"min_effort"
)
max_effort
=
cleaned_data
.
get
(
"max_effort"
)
if
min_effort
and
max_effort
and
min_effort
>
max_effort
:
raise
ValidationError
({
'min_effort'
:
"Minimum effort cannot be greater than Maximum effort"
})
return
cleaned_data
def
__init__
(
self
,
*
args
,
**
kwargs
):
self
.
is_project_coordinator
=
kwargs
.
pop
(
'is_project_coordinator'
,
None
)
super
(
CustomCourseRunForm
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
...
...
course_discovery/apps/publisher/tests/test_forms.py
View file @
7b05eeda
...
...
@@ -77,3 +77,22 @@ class PublisherUserCreationFormTests(TestCase):
user_form
.
cleaned_data
[
'groups'
]
=
[
'test_group'
]
self
.
assertEqual
(
user_form
.
clean
(),
user_form
.
cleaned_data
)
class
PublisherCourseRunEditFormTests
(
TestCase
):
"""
Tests for the publisher 'CustomCourseRunForm'.
"""
def
test_minimum_effort
(
self
):
"""
Verify that 'clean' raises 'ValidationError' error if Minimum effort is greater
than Maximum effort.
"""
run_form
=
CustomCourseRunForm
()
run_form
.
cleaned_data
=
{
'min_effort'
:
4
,
'max_effort'
:
2
}
with
self
.
assertRaises
(
ValidationError
):
run_form
.
clean
()
run_form
.
cleaned_data
[
'min_effort'
]
=
1
self
.
assertEqual
(
run_form
.
clean
(),
run_form
.
cleaned_data
)
course_discovery/conf/locale/en/LC_MESSAGES/django.mo
View file @
7b05eeda
No preview for this file type
course_discovery/conf/locale/en/LC_MESSAGES/django.po
View file @
7b05eeda
...
...
@@ -7,14 +7,14 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-05-0
8 16:26
+0500\n"
"POT-Creation-Date: 2017-05-0
9 15:18
+0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: \n"
#: apps/api/filters.py
#, python-brace-format
...
...
course_discovery/conf/locale/en/LC_MESSAGES/djangojs.mo
View file @
7b05eeda
No preview for this file type
course_discovery/conf/locale/en/LC_MESSAGES/djangojs.po
View file @
7b05eeda
...
...
@@ -7,14 +7,14 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-05-0
8 16:26
+0500\n"
"POT-Creation-Date: 2017-05-0
9 15:18
+0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: \n"
#: static/js/catalogs-change-form.js
msgid "Preview"
...
...
course_discovery/conf/locale/eo/LC_MESSAGES/django.mo
View file @
7b05eeda
No preview for this file type
course_discovery/conf/locale/eo/LC_MESSAGES/django.po
View file @
7b05eeda
...
...
@@ -7,14 +7,14 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-05-0
8 16:26
+0500\n"
"POT-Creation-Date: 2017-05-0
9 15:18
+0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: \n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: apps/api/filters.py
...
...
course_discovery/conf/locale/eo/LC_MESSAGES/djangojs.mo
View file @
7b05eeda
No preview for this file type
course_discovery/conf/locale/eo/LC_MESSAGES/djangojs.po
View file @
7b05eeda
...
...
@@ -7,14 +7,14 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-05-0
8 16:26
+0500\n"
"POT-Creation-Date: 2017-05-0
9 15:18
+0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: \n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: static/js/catalogs-change-form.js
...
...
course_discovery/templates/publisher/course_run/edit_run_form.html
View file @
7b05eeda
...
...
@@ -200,6 +200,9 @@
<div
class=
"col col-6"
>
<label
class=
"field-label "
>
{% trans "Min Effort" %}
</label>
{{ run_form.min_effort }}
{% if run_form.min_effort.errors %}
{{ run_form.min_effort.errors|escape }}
{% endif %}
</div>
<div
class=
"col col-6"
>
<label
class=
"field-label "
>
{% trans "Max Effort" %}
</label>
...
...
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