Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
gm-serializer
Project
Project
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
backend
gm-serializer
Commits
266f0d19
Commit
266f0d19
authored
Aug 23, 2017
by
gushitong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bugfix for magic_pk is None
parent
03c344bd
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
1 deletion
+5
-1
__init__.py
gm_serializer/__init__.py
+1
-1
descriptor.py
gm_serializer/fields/descriptor.py
+4
-0
No files found.
gm_serializer/__init__.py
View file @
266f0d19
__version__
=
'0.
0.9
'
__version__
=
'0.
1.0
'
__author__
=
'gushitong@gmei.com'
__author__
=
'gushitong@gmei.com'
gm_serializer/fields/descriptor.py
View file @
266f0d19
...
@@ -27,6 +27,10 @@ class MagicDescriptor(object):
...
@@ -27,6 +27,10 @@ class MagicDescriptor(object):
related_obj_pk
=
getattr
(
instance
,
"
%
s_id"
%
self
.
field
.
attname
)
related_obj_pk
=
getattr
(
instance
,
"
%
s_id"
%
self
.
field
.
attname
)
if
not
related_obj_pk
:
# process `blank=True` and `null=True`
return
None
if
getattr
(
instance
,
self
.
lazy_name
,
False
):
if
getattr
(
instance
,
self
.
lazy_name
,
False
):
return
related_obj_pk
return
related_obj_pk
...
...
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