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
b8a447c1
Commit
b8a447c1
authored
Feb 26, 2016
by
Waheed Ahmed
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved white label sites to logistration.
ECOM-2948
parent
40dcb510
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
0 deletions
+37
-0
openedx/core/djangoapps/user_api/tests/test_views.py
+13
-0
openedx/core/djangoapps/user_api/views.py
+24
-0
No files found.
openedx/core/djangoapps/user_api/tests/test_views.py
View file @
b8a447c1
...
...
@@ -1200,6 +1200,17 @@ class RegistrationViewTest(ThirdPartyAuthTestMixin, ApiTestCase):
}
)
def
test_registration_form_state
(
self
):
self
.
_assert_reg_field
(
{
"state"
:
"optional"
},
{
"name"
:
"state"
,
"type"
:
"text"
,
"required"
:
False
,
"label"
:
"State/Province/Region"
,
}
)
def
test_registration_form_country
(
self
):
country_options
=
(
[{
"name"
:
"--"
,
"value"
:
""
,
"default"
:
True
}]
+
...
...
@@ -1374,6 +1385,7 @@ class RegistrationViewTest(ThirdPartyAuthTestMixin, ApiTestCase):
"mailing_address"
:
"optional"
,
"goals"
:
"optional"
,
"city"
:
"optional"
,
"state"
:
"optional"
,
"country"
:
"required"
,
"honor_code"
:
"required"
,
},
...
...
@@ -1394,6 +1406,7 @@ class RegistrationViewTest(ThirdPartyAuthTestMixin, ApiTestCase):
"favorite_movie"
,
"favorite_editor"
,
"city"
,
"state"
,
"country"
,
"gender"
,
"year_of_birth"
,
...
...
openedx/core/djangoapps/user_api/views.py
View file @
b8a447c1
...
...
@@ -20,6 +20,7 @@ from rest_framework.views import APIView
from
rest_framework.exceptions
import
ParseError
from
django_countries
import
countries
from
opaque_keys.edx.locations
import
SlashSeparatedCourseKey
from
microsite_configuration
import
microsite
from
openedx.core.lib.api.permissions
import
ApiKeyHeaderPermission
import
third_party_auth
...
...
@@ -160,6 +161,7 @@ class RegistrationView(APIView):
EXTRA_FIELDS
=
[
"city"
,
"state"
,
"country"
,
"gender"
,
"year_of_birth"
,
...
...
@@ -187,6 +189,8 @@ class RegistrationView(APIView):
# Backwards compatibility: Honor code is required by default, unless
# explicitly set to "optional" in Django settings.
self
.
_extra_fields_setting
=
copy
.
deepcopy
(
microsite
.
get_value
(
'REGISTRATION_EXTRA_FIELDS'
))
if
not
self
.
_extra_fields_setting
:
self
.
_extra_fields_setting
=
copy
.
deepcopy
(
settings
.
REGISTRATION_EXTRA_FIELDS
)
self
.
_extra_fields_setting
[
"honor_code"
]
=
self
.
_extra_fields_setting
.
get
(
"honor_code"
,
"required"
)
...
...
@@ -608,6 +612,26 @@ class RegistrationView(APIView):
required
=
required
)
def
_add_state_field
(
self
,
form_desc
,
required
=
False
):
"""Add a State/Province/Region field to a form description.
Arguments:
form_desc: A form description
Keyword Arguments:
required (bool): Whether this field is required; defaults to False
"""
# Translators: This label appears above a field on the registration form
# which allows the user to input the State/Province/Region in which they live.
state_label
=
_
(
u"State/Province/Region"
)
form_desc
.
add_field
(
"state"
,
label
=
state_label
,
required
=
required
)
def
_add_country_field
(
self
,
form_desc
,
required
=
True
):
"""Add a country field to a form description.
...
...
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