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
a335309b
Commit
a335309b
authored
Aug 19, 2016
by
Tom Christie
Committed by
GitHub
Aug 19, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add __str__ method to PKOnlyObject (#4423)
parent
63342e81
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletions
+5
-1
rest_framework/relations.py
+5
-1
No files found.
rest_framework/relations.py
View file @
a335309b
...
@@ -10,7 +10,7 @@ from django.core.urlresolvers import (
...
@@ -10,7 +10,7 @@ from django.core.urlresolvers import (
from
django.db.models
import
Manager
from
django.db.models
import
Manager
from
django.db.models.query
import
QuerySet
from
django.db.models.query
import
QuerySet
from
django.utils
import
six
from
django.utils
import
six
from
django.utils.encoding
import
smart_text
from
django.utils.encoding
import
python_2_unicode_compatible
,
smart_text
from
django.utils.six.moves.urllib
import
parse
as
urlparse
from
django.utils.six.moves.urllib
import
parse
as
urlparse
from
django.utils.translation
import
ugettext_lazy
as
_
from
django.utils.translation
import
ugettext_lazy
as
_
...
@@ -47,6 +47,7 @@ class Hyperlink(six.text_type):
...
@@ -47,6 +47,7 @@ class Hyperlink(six.text_type):
is_hyperlink
=
True
is_hyperlink
=
True
@python_2_unicode_compatible
class
PKOnlyObject
(
object
):
class
PKOnlyObject
(
object
):
"""
"""
This is a mock object, used for when we only need the pk of the object
This is a mock object, used for when we only need the pk of the object
...
@@ -56,6 +57,9 @@ class PKOnlyObject(object):
...
@@ -56,6 +57,9 @@ class PKOnlyObject(object):
def
__init__
(
self
,
pk
):
def
__init__
(
self
,
pk
):
self
.
pk
=
pk
self
.
pk
=
pk
def
__str__
(
self
):
return
"
%
s"
%
self
.
pk
# We assume that 'validators' are intended for the child serializer,
# We assume that 'validators' are intended for the child serializer,
# rather than the parent serializer.
# rather than the parent serializer.
...
...
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