Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-rest-framework
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
django-rest-framework
Commits
fec7c4b4
Commit
fec7c4b4
authored
Oct 02, 2014
by
Tom Christie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Browsable API tweaks
parent
df7b6fcf
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
6 additions
and
6 deletions
+6
-6
rest_framework/fields.py
+2
-3
rest_framework/relations.py
+1
-0
rest_framework/serializers.py
+1
-0
rest_framework/static/rest_framework/css/bootstrap-tweaks.css
+1
-1
rest_framework/static/rest_framework/css/default.css
+1
-2
No files found.
rest_framework/fields.py
View file @
fec7c4b4
...
@@ -106,7 +106,7 @@ class Field(object):
...
@@ -106,7 +106,7 @@ class Field(object):
'null'
:
_
(
'This field may not be null.'
)
'null'
:
_
(
'This field may not be null.'
)
}
}
default_validators
=
[]
default_validators
=
[]
default_empty_html
=
None
default_empty_html
=
empty
initial
=
None
initial
=
None
def
__init__
(
self
,
read_only
=
False
,
write_only
=
False
,
def
__init__
(
self
,
read_only
=
False
,
write_only
=
False
,
...
@@ -375,7 +375,6 @@ class NullBooleanField(Field):
...
@@ -375,7 +375,6 @@ class NullBooleanField(Field):
default_error_messages
=
{
default_error_messages
=
{
'invalid'
:
_
(
'`{input}` is not a valid boolean.'
)
'invalid'
:
_
(
'`{input}` is not a valid boolean.'
)
}
}
default_empty_html
=
None
initial
=
None
initial
=
None
TRUE_VALUES
=
set
((
't'
,
'T'
,
'true'
,
'True'
,
'TRUE'
,
'1'
,
1
,
True
))
TRUE_VALUES
=
set
((
't'
,
'T'
,
'true'
,
'True'
,
'TRUE'
,
'1'
,
1
,
True
))
FALSE_VALUES
=
set
((
'f'
,
'F'
,
'false'
,
'False'
,
'FALSE'
,
'0'
,
0
,
0.0
,
False
))
FALSE_VALUES
=
set
((
'f'
,
'F'
,
'false'
,
'False'
,
'FALSE'
,
'0'
,
0
,
0.0
,
False
))
...
@@ -411,7 +410,6 @@ class CharField(Field):
...
@@ -411,7 +410,6 @@ class CharField(Field):
default_error_messages
=
{
default_error_messages
=
{
'blank'
:
_
(
'This field may not be blank.'
)
'blank'
:
_
(
'This field may not be blank.'
)
}
}
default_empty_html
=
''
initial
=
''
initial
=
''
def
__init__
(
self
,
**
kwargs
):
def
__init__
(
self
,
**
kwargs
):
...
@@ -852,6 +850,7 @@ class MultipleChoiceField(ChoiceField):
...
@@ -852,6 +850,7 @@ class MultipleChoiceField(ChoiceField):
'invalid_choice'
:
_
(
'`{input}` is not a valid choice.'
),
'invalid_choice'
:
_
(
'`{input}` is not a valid choice.'
),
'not_a_list'
:
_
(
'Expected a list of items but got type `{input_type}`'
)
'not_a_list'
:
_
(
'Expected a list of items but got type `{input_type}`'
)
}
}
default_empty_html
=
[]
def
to_internal_value
(
self
,
data
):
def
to_internal_value
(
self
,
data
):
if
isinstance
(
data
,
type
(
''
))
or
not
hasattr
(
data
,
'__iter__'
):
if
isinstance
(
data
,
type
(
''
))
or
not
hasattr
(
data
,
'__iter__'
):
...
...
rest_framework/relations.py
View file @
fec7c4b4
...
@@ -249,6 +249,7 @@ class ManyRelation(Field):
...
@@ -249,6 +249,7 @@ class ManyRelation(Field):
You shouldn't need to be using this class directly yourself.
You shouldn't need to be using this class directly yourself.
"""
"""
initial
=
[]
initial
=
[]
default_empty_html
=
[]
def
__init__
(
self
,
child_relation
=
None
,
*
args
,
**
kwargs
):
def
__init__
(
self
,
child_relation
=
None
,
*
args
,
**
kwargs
):
self
.
child_relation
=
child_relation
self
.
child_relation
=
child_relation
...
...
rest_framework/serializers.py
View file @
fec7c4b4
...
@@ -254,6 +254,7 @@ class Serializer(BaseSerializer):
...
@@ -254,6 +254,7 @@ class Serializer(BaseSerializer):
return
ReturnDict
([
return
ReturnDict
([
(
field_name
,
field
.
get_value
(
self
.
_initial_data
))
(
field_name
,
field
.
get_value
(
self
.
_initial_data
))
for
field_name
,
field
in
self
.
fields
.
items
()
for
field_name
,
field
in
self
.
fields
.
items
()
if
field
.
get_value
(
self
.
_initial_data
)
is
not
empty
],
serializer
=
self
)
],
serializer
=
self
)
#return self.to_representation(self._initial_data)
#return self.to_representation(self._initial_data)
...
...
rest_framework/static/rest_framework/css/bootstrap-tweaks.css
View file @
fec7c4b4
...
@@ -173,7 +173,7 @@ footer a:hover {
...
@@ -173,7 +173,7 @@ footer a:hover {
.page-header
{
.page-header
{
border-bottom
:
none
;
border-bottom
:
none
;
padding-bottom
:
0px
;
padding-bottom
:
0px
;
margin
-bottom
:
20px
;
margin
:
0
;
}
}
/* custom general page styles */
/* custom general page styles */
...
...
rest_framework/static/rest_framework/css/default.css
View file @
fec7c4b4
...
@@ -33,7 +33,7 @@ h2, h3 {
...
@@ -33,7 +33,7 @@ h2, h3 {
}
}
ul
.breadcrumb
{
ul
.breadcrumb
{
margin
:
8
0px
0
0
0
;
margin
:
7
0px
0
0
0
;
}
}
form
select
,
form
input
,
form
textarea
{
form
select
,
form
input
,
form
textarea
{
...
@@ -67,5 +67,4 @@ pre {
...
@@ -67,5 +67,4 @@ pre {
.page-header
{
.page-header
{
border-bottom
:
none
;
border-bottom
:
none
;
padding-bottom
:
0px
;
padding-bottom
:
0px
;
margin-bottom
:
20px
;
}
}
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