nested resources now working

This commit is contained in:
Tom Christie 2011-05-16 09:14:01 +01:00
parent 47645319c9
commit e92002ddde

View File

@ -10,6 +10,7 @@ import inspect
import re
# TODO: _IgnoreFieldException
def _model_to_dict(instance, resource=None):
"""
@ -32,9 +33,9 @@ def _model_to_dict(instance, resource=None):
#else:
# fields = set(opts.fields + opts.many_to_many)
fields = resource.fields
include = resource.include
exclude = resource.exclude
fields = resource and resource.fields or ()
include = resource and resource.include or ()
exclude = resource and resource.exclude or ()
extra_fields = fields and list(resource.fields) or []
@ -157,8 +158,13 @@ class FormResource(Resource):
On calling validate() this validator may set a `.bound_form_instance` attribute on the
view, which may be used by some renderers.
"""
"""
The form class that should be used for request validation.
"""
form = None
def validate_request(self, data, files):
"""
Given some content as input return some cleaned, validated content.
@ -286,7 +292,7 @@ class ModelResource(FormResource):
exclude = ('id', 'pk')
"""
The list of fields to include. This is only used if ``fields`` is not set.
The list of extra fields to include. This is only used if ``fields`` is not set.
"""
include = ('url',)