本文整理匯總了Python中django.core.exceptions.ValidationError.messages方法的典型用法代碼示例。如果您正苦於以下問題:Python ValidationError.messages方法的具體用法?Python ValidationError.messages怎麽用?Python ValidationError.messages使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類django.core.exceptions.ValidationError
的用法示例。
在下文中一共展示了ValidationError.messages方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: ValidationError
# 需要導入模塊: from django.core.exceptions import ValidationError [as 別名]
# 或者: from django.core.exceptions.ValidationError import messages [as 別名]
for name, field in self.api_fields.iteritems():
if not name in obj:
value = None
else:
value = obj[name]
try:
cleaned_value = field.unserialize(value)
new_dict[name] = cleaned_value
except ValidationError, e:
errors[name] = e.messages
if errors:
error = ValidationError("There were multiple errors when validating the data.")
error.messages = errors
raise error
return new_dict
def _content_types_urlconf(self):
types = "|".join(self.serializer.content_types.keys())
return r"(?P<content_type>(%s))" % (types, )
def _determine_content_type_from_request(self, request, content_type=None):
request_ct = request.META.get("HTTP_ACCEPT", None)
allowed_formats = self.serializer.content_types.keys()
allowed_cts = self.serializer.content_types.values()