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
1929159d
Commit
1929159d
authored
Jan 29, 2013
by
Tom Christie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Docs tweaks.
parent
5f065153
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
9 deletions
+5
-9
docs/api-guide/fields.md
+2
-0
docs/api-guide/serializers.md
+3
-9
No files found.
docs/api-guide/fields.md
View file @
1929159d
...
@@ -242,5 +242,7 @@ Signature and validation is the same as with `FileField`.
...
@@ -242,5 +242,7 @@ Signature and validation is the same as with `FileField`.
**Note:**
`FileFields`
and
`ImageFields`
are only suitable for use with MultiPartParser, since e.g. json doesn't support file uploads.
**Note:**
`FileFields`
and
`ImageFields`
are only suitable for use with MultiPartParser, since e.g. json doesn't support file uploads.
Django's regular
[
FILE_UPLOAD_HANDLERS
]
are used for handling uploaded files.
Django's regular
[
FILE_UPLOAD_HANDLERS
]
are used for handling uploaded files.
---
[
cite
]:
https://docs.djangoproject.com/en/dev/ref/forms/api/#django.forms.Form.cleaned_data
[
cite
]:
https://docs.djangoproject.com/en/dev/ref/forms/api/#django.forms.Form.cleaned_data
[
FILE_UPLOAD_HANDLERS
]:
https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-FILE_UPLOAD_HANDLERS
[
FILE_UPLOAD_HANDLERS
]:
https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-FILE_UPLOAD_HANDLERS
docs/api-guide/serializers.md
View file @
1929159d
...
@@ -190,18 +190,12 @@ By default field values are treated as mapping to an attribute on the object. I
...
@@ -190,18 +190,12 @@ By default field values are treated as mapping to an attribute on the object. I
As an example, let's create a field that can be used represent the class name of the object being serialized:
As an example, let's create a field that can be used represent the class name of the object being serialized:
class ClassNameField(serializers.
Writable
Field):
class ClassNameField(serializers.Field):
def field_to_native(self, obj, field_name):
def field_to_native(self, obj, field_name):
"""
"""
Serialize the object's class name
, not an attribute of the object
.
Serialize the object's class name.
"""
"""
return obj.__class__.__name__
return obj.__class__
def field_from_native(self, data, field_name, into):
"""
We don't want to set anything when we revert this field.
"""
pass
---
---
...
...
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