summaryrefslogtreecommitdiff
path: root/django/core/serializers/python.py
diff options
context:
space:
mode:
authormartin.bohacek <bohacekm@gmail.com>2012-06-05 13:29:33 +0200
committermartin.bohacek <bohacekm@gmail.com>2012-06-05 13:29:33 +0200
commiteee791e9b216333ad0b4c6c441a88828bf9aee62 (patch)
tree3f01e97ea9b0ac28e9c9718b35ae92d163865b1c /django/core/serializers/python.py
parentfbb73894395b728ec96c661da6f87523718c5398 (diff)
parent840ffd80baad85c05670d6b642f654cffaa93cc3 (diff)
Merge branch 'master' of https://github.com/django/django
Diffstat (limited to 'django/core/serializers/python.py')
-rw-r--r--django/core/serializers/python.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/django/core/serializers/python.py b/django/core/serializers/python.py
index 195bf11d24..49120434eb 100644
--- a/django/core/serializers/python.py
+++ b/django/core/serializers/python.py
@@ -27,13 +27,16 @@ class Serializer(base.Serializer):
self._current = {}
def end_object(self, obj):
- self.objects.append({
- "model" : smart_unicode(obj._meta),
- "pk" : smart_unicode(obj._get_pk_val(), strings_only=True),
- "fields" : self._current
- })
+ self.objects.append(self.get_dump_object(obj))
self._current = None
+ def get_dump_object(self, obj):
+ return {
+ "pk": smart_unicode(obj._get_pk_val(), strings_only=True),
+ "model": smart_unicode(obj._meta),
+ "fields": self._current
+ }
+
def handle_field(self, obj, field):
value = field._get_val_from_obj(obj)
# Protected types (i.e., primitives like None, numbers, dates,