Tastypie のカスタム検証クラスを使用して、フィールドのエラー メッセージを取得しようとしています。
Tastipye Documentation Web サイト (AwesomeValidation クラス) のコードを使用しました: http://django-tastypie.readthedocs.org/en/latest/validation.html#implementing-your-own-validation
これが私のリソースクラスです:
class UserResource(ModelResource):
class Meta:
queryset = User.objects.all()
resource_name = 'user'
authorization = Authorization()
validation = AwesomeValidation()
私はスランバーを使用して POST リクエストを試みます:
import slumber
api = slumber.API("127.0.0.1", auth=("auth", "auth"))
api.user.post({"username": "test", "password": "test", "password_confirm": "test", "email": "test@example.com"})
エラー 400 が表示されますが、エラー メッセージは表示されません。
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/slumber/__init__.py", line 125, in post
resp = self._request("POST", data=s.dumps(data), params=kwargs)
File "/usr/local/lib/python2.7/dist-packages/slumber/__init__.py", line 104, in _request
raise exceptions.HttpClientError("Client Error %s: %s" % (resp.status_code, url), response=resp, content=resp.content)
slumber.exceptions.HttpClientError: Client Error 400: http://127.0.0.1:8000/api/v1/user/
エラーメッセージを取得するためにカスタム検証クラスと関係がありますか?