check depth type which should be int

This commit is contained in:
kycool 2017-09-01 18:30:59 +08:00
parent 27c382c98d
commit 5fdeb74405

View File

@ -986,6 +986,7 @@ class ModelSerializer(Serializer):
depth = getattr(self.Meta, 'depth', 0) depth = getattr(self.Meta, 'depth', 0)
if depth is not None: if depth is not None:
assert isinstance(depth, int), "'depth' should be integer variable."
assert depth >= 0, "'depth' may not be negative." assert depth >= 0, "'depth' may not be negative."
assert depth <= 10, "'depth' may not be greater than 10." assert depth <= 10, "'depth' may not be greater than 10."