Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-notes-api
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-notes-api
Commits
9f78f931
Commit
9f78f931
authored
Jan 13, 2015
by
Oleg Marshev
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #18 from edx/oleg/allow-blank-text
Allow text field to be blank.
parents
37b20911
57eff5b6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
1 deletions
+11
-1
notesapi/v1/models.py
+1
-1
notesapi/v1/tests/test_views.py
+10
-0
No files found.
notesapi/v1/models.py
View file @
9f78f931
...
...
@@ -11,7 +11,7 @@ class Note(models.Model):
course_id
=
models
.
CharField
(
max_length
=
255
,
db_index
=
True
)
usage_id
=
models
.
CharField
(
max_length
=
255
,
help_text
=
"ID of XBlock where the text comes from"
)
quote
=
models
.
TextField
(
default
=
""
)
text
=
models
.
TextField
(
default
=
""
,
help_text
=
"Student's thoughts on the quote"
)
text
=
models
.
TextField
(
default
=
""
,
blank
=
True
,
help_text
=
"Student's thoughts on the quote"
)
ranges
=
models
.
TextField
(
help_text
=
"JSON, describes position of quote in the source text"
)
created
=
models
.
DateTimeField
(
auto_now_add
=
True
)
updated
=
models
.
DateTimeField
(
auto_now
=
True
)
...
...
notesapi/v1/tests/test_views.py
View file @
9f78f931
...
...
@@ -104,6 +104,16 @@ class AnnotationListViewTests(BaseAnnotationViewTests):
self
.
assertEqual
(
response
.
data
[
'user'
],
TEST_USER
)
def
test_create_blank_text
(
self
):
"""
Ensure we can create a new note with empty text field.
"""
url
=
reverse
(
'api:v1:annotations'
)
self
.
payload
[
'text'
]
=
''
response
=
self
.
client
.
post
(
url
,
self
.
payload
,
format
=
'json'
)
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_201_CREATED
)
self
.
assertEqual
(
response
.
data
[
'text'
],
''
)
def
test_create_ignore_created
(
self
):
"""
Test if annotation 'created' field is not used by API.
...
...
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