mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-30 05:24:00 +03:00
Merge pull request #92 from mwesterhof/master
Serializer.serialize_model fix of uncaught _SkipField exceptions
This commit is contained in:
commit
4f38e78580
|
@ -229,6 +229,7 @@ class Serializer(object):
|
||||||
|
|
||||||
# serialize each required field
|
# serialize each required field
|
||||||
for fname in fields:
|
for fname in fields:
|
||||||
|
try:
|
||||||
if hasattr(self, smart_str(fname)):
|
if hasattr(self, smart_str(fname)):
|
||||||
# check first for a method 'fname' on self first
|
# check first for a method 'fname' on self first
|
||||||
meth = getattr(self, fname)
|
meth = getattr(self, fname)
|
||||||
|
@ -243,7 +244,6 @@ class Serializer(object):
|
||||||
else:
|
else:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
try:
|
|
||||||
key = self.serialize_key(fname)
|
key = self.serialize_key(fname)
|
||||||
val = self.serialize_val(fname, obj)
|
val = self.serialize_val(fname, obj)
|
||||||
data[key] = val
|
data[key] = val
|
||||||
|
|
Loading…
Reference in New Issue
Block a user