mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-02-02 20:54:42 +03:00
.validate() on serializer fields
This commit is contained in:
parent
9805a085fb
commit
d2d412993f
|
@ -254,6 +254,7 @@ class Field(object):
|
||||||
|
|
||||||
value = self.to_internal_value(data)
|
value = self.to_internal_value(data)
|
||||||
self.run_validators(value)
|
self.run_validators(value)
|
||||||
|
self.validate(value)
|
||||||
return value
|
return value
|
||||||
|
|
||||||
def run_validators(self, value):
|
def run_validators(self, value):
|
||||||
|
@ -270,6 +271,9 @@ class Field(object):
|
||||||
if errors:
|
if errors:
|
||||||
raise ValidationError(errors)
|
raise ValidationError(errors)
|
||||||
|
|
||||||
|
def validate(self, value):
|
||||||
|
pass
|
||||||
|
|
||||||
def to_internal_value(self, data):
|
def to_internal_value(self, data):
|
||||||
"""
|
"""
|
||||||
Transform the *incoming* primative data into a native value.
|
Transform the *incoming* primative data into a native value.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user