Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions fabfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@


def push(commit, title, desc):
mail = "rapospectre@gmail.com"
mail = "dealiaxy@gmail.com"
commit_message = '<{0}> {1}\r\n\r\nAuthor:{2}\r\n\r\nDesc: {3}'.format(commit, title, mail, desc)
local("git add .")
local("git commit -m '{0}'".format(commit_message))
local("git push origin master")
local("git push github master")
14 changes: 5 additions & 9 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Django Simple Serializer

本项目fork自:https://github.com/bluedazzle/django-simple-serializer
---

[English Doc][1]
Expand Down Expand Up @@ -68,13 +68,6 @@ data:

默认情况下, 序列器会返回一个 list 或者 dict(对于单个model实例), 你可以设置参数 “output_type” 来决定序列器返回 json/raw.


## 交流

**扫描二维码,验证信息输入 'dss' 或 '加群' 进入微信交流群**

![screenshot](https://raw.githubusercontent.com/bluedazzle/wechat_sender/master/qr.jpeg)

----------

## API 手册
Expand Down Expand Up @@ -552,7 +545,10 @@ response:

## 版本历史

### 当前版本:2.0.7
### 当前版本:2.0.8

##### 2018.06.08 v2.0.8:
修复 AutoField 序列化问题

##### 2017.04.26 v2.0.7:

Expand Down
298 changes: 0 additions & 298 deletions src/README.rst

This file was deleted.

13 changes: 9 additions & 4 deletions src/dss/Serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,16 @@ def data_inspect(self, data, extra=None):
obj_dict = {}
concrete_model = data._meta.concrete_model
for field in concrete_model._meta.local_fields:
if field.rel is None:
if self.check_attr(field.name) and hasattr(data, field.name):
obj_dict[field.name] = self.data_inspect(getattr(data, field.name))
# 检查 field 是否存在 rel 这个属性,为'AutoField' object has no attribute 'rel'错误填坑
if hasattr(field, 'rel'):
if field.rel is None:
if self.check_attr(field.name) and hasattr(data, field.name):
obj_dict[field.name] = self.data_inspect(getattr(data, field.name))
else:
if self.check_attr(field.name) and self.foreign:
obj_dict[field.name] = self.data_inspect(getattr(data, field.name))
else:
if self.check_attr(field.name) and self.foreign:
if self.check_attr(field.name) and hasattr(data, field.name):
obj_dict[field.name] = self.data_inspect(getattr(data, field.name))
for field in concrete_model._meta.many_to_many:
if self.check_attr(field.name) and self.many:
Expand Down
Loading