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
c3a39934
Commit
c3a39934
authored
Apr 13, 2015
by
Andy Armstrong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Limit the size of the user profile's "bio" field
TNL-1990
parent
e6c3644b
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
10 additions
and
8 deletions
+10
-8
common/djangoapps/student/migrations/0047_add_bio_field.py
+2
-2
common/djangoapps/student/migrations/0048_add_profile_image_version.py
+1
-1
common/djangoapps/student/migrations/0049_auto__add_languageproficiency__add_unique_languageproficiency_code_use.py
+1
-1
common/djangoapps/student/models.py
+1
-1
openedx/core/djangoapps/user_api/accounts/serializers.py
+4
-0
openedx/core/djangoapps/user_api/accounts/tests/test_views.py
+1
-3
No files found.
common/djangoapps/student/migrations/0047_add_bio_field.py
View file @
c3a39934
...
@@ -10,7 +10,7 @@ class Migration(SchemaMigration):
...
@@ -10,7 +10,7 @@ class Migration(SchemaMigration):
def
forwards
(
self
,
orm
):
def
forwards
(
self
,
orm
):
# Adding field 'UserProfile.bio'
# Adding field 'UserProfile.bio'
db
.
add_column
(
'auth_userprofile'
,
'bio'
,
db
.
add_column
(
'auth_userprofile'
,
'bio'
,
self
.
gf
(
'django.db.models.fields.
TextField'
)(
null
=
True
,
blank
=
Tru
e
),
self
.
gf
(
'django.db.models.fields.
CharField'
)(
max_length
=
3000
,
null
=
True
,
blank
=
True
,
db_index
=
Fals
e
),
keep_default
=
False
)
keep_default
=
False
)
...
@@ -152,7 +152,7 @@ class Migration(SchemaMigration):
...
@@ -152,7 +152,7 @@ class Migration(SchemaMigration):
'student.userprofile'
:
{
'student.userprofile'
:
{
'Meta'
:
{
'object_name'
:
'UserProfile'
,
'db_table'
:
"'auth_userprofile'"
},
'Meta'
:
{
'object_name'
:
'UserProfile'
,
'db_table'
:
"'auth_userprofile'"
},
'allow_certificate'
:
(
'django.db.models.fields.BooleanField'
,
[],
{
'default'
:
'True'
}),
'allow_certificate'
:
(
'django.db.models.fields.BooleanField'
,
[],
{
'default'
:
'True'
}),
'bio'
:
(
'django.db.models.fields.
TextField'
,
[],
{
'null'
:
'True'
,
'blank'
:
'True'
}),
'bio'
:
(
'django.db.models.fields.
CharField'
,
[],
{
'db_index'
:
'False'
,
'null'
:
'True'
,
'blank'
:
'True'
}),
'city'
:
(
'django.db.models.fields.TextField'
,
[],
{
'null'
:
'True'
,
'blank'
:
'True'
}),
'city'
:
(
'django.db.models.fields.TextField'
,
[],
{
'null'
:
'True'
,
'blank'
:
'True'
}),
'country'
:
(
'django_countries.fields.CountryField'
,
[],
{
'max_length'
:
'2'
,
'null'
:
'True'
,
'blank'
:
'True'
}),
'country'
:
(
'django_countries.fields.CountryField'
,
[],
{
'max_length'
:
'2'
,
'null'
:
'True'
,
'blank'
:
'True'
}),
'courseware'
:
(
'django.db.models.fields.CharField'
,
[],
{
'default'
:
"'course.xml'"
,
'max_length'
:
'255'
,
'blank'
:
'True'
}),
'courseware'
:
(
'django.db.models.fields.CharField'
,
[],
{
'default'
:
"'course.xml'"
,
'max_length'
:
'255'
,
'blank'
:
'True'
}),
...
...
common/djangoapps/student/migrations/0048_add_profile_image_version.py
View file @
c3a39934
...
@@ -152,7 +152,7 @@ class Migration(SchemaMigration):
...
@@ -152,7 +152,7 @@ class Migration(SchemaMigration):
'student.userprofile'
:
{
'student.userprofile'
:
{
'Meta'
:
{
'object_name'
:
'UserProfile'
,
'db_table'
:
"'auth_userprofile'"
},
'Meta'
:
{
'object_name'
:
'UserProfile'
,
'db_table'
:
"'auth_userprofile'"
},
'allow_certificate'
:
(
'django.db.models.fields.BooleanField'
,
[],
{
'default'
:
'True'
}),
'allow_certificate'
:
(
'django.db.models.fields.BooleanField'
,
[],
{
'default'
:
'True'
}),
'bio'
:
(
'django.db.models.fields.
TextField'
,
[],
{
'null'
:
'True'
,
'blank'
:
'True'
}),
'bio'
:
(
'django.db.models.fields.
CharField'
,
[],
{
'db_index'
:
'False'
,
'null'
:
'True'
,
'blank'
:
'True'
}),
'city'
:
(
'django.db.models.fields.TextField'
,
[],
{
'null'
:
'True'
,
'blank'
:
'True'
}),
'city'
:
(
'django.db.models.fields.TextField'
,
[],
{
'null'
:
'True'
,
'blank'
:
'True'
}),
'country'
:
(
'django_countries.fields.CountryField'
,
[],
{
'max_length'
:
'2'
,
'null'
:
'True'
,
'blank'
:
'True'
}),
'country'
:
(
'django_countries.fields.CountryField'
,
[],
{
'max_length'
:
'2'
,
'null'
:
'True'
,
'blank'
:
'True'
}),
'courseware'
:
(
'django.db.models.fields.CharField'
,
[],
{
'default'
:
"'course.xml'"
,
'max_length'
:
'255'
,
'blank'
:
'True'
}),
'courseware'
:
(
'django.db.models.fields.CharField'
,
[],
{
'default'
:
"'course.xml'"
,
'max_length'
:
'255'
,
'blank'
:
'True'
}),
...
...
common/djangoapps/student/migrations/0049_auto__add_languageproficiency__add_unique_languageproficiency_code_use.py
View file @
c3a39934
...
@@ -167,7 +167,7 @@ class Migration(SchemaMigration):
...
@@ -167,7 +167,7 @@ class Migration(SchemaMigration):
'student.userprofile'
:
{
'student.userprofile'
:
{
'Meta'
:
{
'object_name'
:
'UserProfile'
,
'db_table'
:
"'auth_userprofile'"
},
'Meta'
:
{
'object_name'
:
'UserProfile'
,
'db_table'
:
"'auth_userprofile'"
},
'allow_certificate'
:
(
'django.db.models.fields.BooleanField'
,
[],
{
'default'
:
'True'
}),
'allow_certificate'
:
(
'django.db.models.fields.BooleanField'
,
[],
{
'default'
:
'True'
}),
'bio'
:
(
'django.db.models.fields.
TextField'
,
[],
{
'null'
:
'True'
,
'blank'
:
'True'
}),
'bio'
:
(
'django.db.models.fields.
CharField'
,
[],
{
'db_index'
:
'False'
,
'null'
:
'True'
,
'blank'
:
'True'
}),
'city'
:
(
'django.db.models.fields.TextField'
,
[],
{
'null'
:
'True'
,
'blank'
:
'True'
}),
'city'
:
(
'django.db.models.fields.TextField'
,
[],
{
'null'
:
'True'
,
'blank'
:
'True'
}),
'country'
:
(
'django_countries.fields.CountryField'
,
[],
{
'max_length'
:
'2'
,
'null'
:
'True'
,
'blank'
:
'True'
}),
'country'
:
(
'django_countries.fields.CountryField'
,
[],
{
'max_length'
:
'2'
,
'null'
:
'True'
,
'blank'
:
'True'
}),
'courseware'
:
(
'django.db.models.fields.CharField'
,
[],
{
'default'
:
"'course.xml'"
,
'max_length'
:
'255'
,
'blank'
:
'True'
}),
'courseware'
:
(
'django.db.models.fields.CharField'
,
[],
{
'default'
:
"'course.xml'"
,
'max_length'
:
'255'
,
'blank'
:
'True'
}),
...
...
common/djangoapps/student/models.py
View file @
c3a39934
...
@@ -250,7 +250,7 @@ class UserProfile(models.Model):
...
@@ -250,7 +250,7 @@ class UserProfile(models.Model):
country
=
CountryField
(
blank
=
True
,
null
=
True
)
country
=
CountryField
(
blank
=
True
,
null
=
True
)
goals
=
models
.
TextField
(
blank
=
True
,
null
=
True
)
goals
=
models
.
TextField
(
blank
=
True
,
null
=
True
)
allow_certificate
=
models
.
BooleanField
(
default
=
1
)
allow_certificate
=
models
.
BooleanField
(
default
=
1
)
bio
=
models
.
TextField
(
blank
=
True
,
null
=
Tru
e
)
bio
=
models
.
CharField
(
blank
=
True
,
null
=
True
,
max_length
=
3000
,
db_index
=
Fals
e
)
profile_image_uploaded_at
=
models
.
DateTimeField
(
null
=
True
)
profile_image_uploaded_at
=
models
.
DateTimeField
(
null
=
True
)
@property
@property
...
...
openedx/core/djangoapps/user_api/accounts/serializers.py
View file @
c3a39934
...
@@ -93,6 +93,10 @@ class AccountLegacyProfileSerializer(serializers.HyperlinkedModelSerializer, Rea
...
@@ -93,6 +93,10 @@ class AccountLegacyProfileSerializer(serializers.HyperlinkedModelSerializer, Rea
""" Converts empty string to None, to indicate not set. Replaced by to_representation in version 3. """
""" Converts empty string to None, to indicate not set. Replaced by to_representation in version 3. """
return
AccountLegacyProfileSerializer
.
convert_empty_to_None
(
value
)
return
AccountLegacyProfileSerializer
.
convert_empty_to_None
(
value
)
def
transform_bio
(
self
,
user_profile
,
value
):
""" Converts empty string to None, to indicate not set. Replaced by to_representation in version 3. """
return
AccountLegacyProfileSerializer
.
convert_empty_to_None
(
value
)
@staticmethod
@staticmethod
def
convert_empty_to_None
(
value
):
def
convert_empty_to_None
(
value
):
""" Helper method to convert empty string to None (other values pass through). """
""" Helper method to convert empty string to None (other values pass through). """
...
...
openedx/core/djangoapps/user_api/accounts/tests/test_views.py
View file @
c3a39934
...
@@ -366,10 +366,8 @@ class TestAccountAPI(UserAPITestCase):
...
@@ -366,10 +366,8 @@ class TestAccountAPI(UserAPITestCase):
(
"name"
,
u"ȻħȺɍłɇs"
,
"z "
,
u"The name field must be at least 2 characters long."
),
(
"name"
,
u"ȻħȺɍłɇs"
,
"z "
,
u"The name field must be at least 2 characters long."
),
(
"goals"
,
"Smell the roses"
),
(
"goals"
,
"Smell the roses"
),
(
"mailing_address"
,
"Sesame Street"
),
(
"mailing_address"
,
"Sesame Street"
),
(
"bio"
,
"Lacrosse-playing superhero"
),
(
"bio"
,
u"壓是進界推日不復女"
),
# Note that we store the raw data, so it is up to client to escape the HTML.
# Note that we store the raw data, so it is up to client to escape the HTML.
(
"bio"
,
"<html>fancy text</html>
"
),
(
"bio"
,
u"<html>Lacrosse-playing superhero 壓是進界推日不復女</html>"
,
"z"
*
3001
,
u"Ensure this value has at most 3000 characters (it has 3001).
"
),
# Note that email is tested below, as it is not immediately updated.
# Note that email is tested below, as it is not immediately updated.
# Note that language_proficiencies is tested below as there are multiple error and success conditions.
# Note that language_proficiencies is tested below as there are multiple error and success conditions.
)
)
...
...
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