diff --git a/AUTHORS b/AUTHORS index b413a191c..c5c9c1b7f 100644 --- a/AUTHORS +++ b/AUTHORS @@ -83,6 +83,7 @@ Contributors: * Yuri Govorushchenko (metametadata) for enhancing documentation on how to convert list of resources into JSON within a django template. * Revolution Systems & The Python Software Foundation for funding a significant portion of the port to Python 3! * tunix for a patch related to Tastypie's timezone-aware dates. +* Steven Davidson (damycra) for a documentation patch. Thanks to Tav for providing validate_jsonp.py, placed in public domain. diff --git a/docs/resources.rst b/docs/resources.rst index 66ebbbcc5..e0b035e17 100644 --- a/docs/resources.rst +++ b/docs/resources.rst @@ -263,7 +263,7 @@ A complex example:: # Make sure we don't have to worry about "divide by zero" errors. if not bundle.obj.rating_set.count(): - return rating + return total_score # We'll run over all the ``Rating`` objects & calculate an average. for rating in bundle.obj.rating_set.all(): @@ -624,7 +624,7 @@ The inner ``Meta`` class allows for class-level configuration of how the If you place any callables in this, they'll only be evaluated once (when the ``Meta`` class is instantiated). This especially affects things that - are date/time related. Please see the :ref:cookbook for a way around this. + are date/time related. Please see the :doc:`cookbook` for a way around this. ``fields`` ---------- @@ -712,7 +712,7 @@ Advanced Filtering If you need to filter things other than ORM resources or wish to apply additional constraints (e.g. text filtering using `django-haystack -` rather than simple database queries) your +`_ rather than simple database queries) your :class:`~tastypie.resources.Resource` may define a custom :meth:`~tastypie.resource.Resource.build_filters` method which allows you to filter the queryset before processing a request:: @@ -1522,14 +1522,14 @@ For each object in ``objects``: considered "new" and is handled like a ``POST`` to the resource list. * If the dict has a ``resource_uri`` key and the ``resource_uri`` refers - to an existing resource then the item is a update; it's treated + to an existing resource then the item is an update; it's treated like a ``PATCH`` to the corresponding resource detail. * If the dict has a ``resource_uri`` but the resource *doesn't* exist, then this is considered to be a create-via-``PUT``. -Each entry in ``deleted_objects`` referes to a resource URI of an existing -resource to be deleted; each is handled like a ``DELETE`` to the relevent +Each entry in ``deleted_objects`` refers to a resource URI of an existing +resource to be deleted; each is handled like a ``DELETE`` to the relevant resource. In any case: @@ -1631,7 +1631,7 @@ additional fields based on the associated model. .. method:: ModelResource.check_filtering(self, field_name, filter_type='exact', filter_bits=None) -Given a field name, a optional filter type and an optional list of +Given a field name, an optional filter type and an optional list of additional relations, determine if a field can be filtered on. If a filter does not meet the needed conditions, it should raise an diff --git a/tastypie/fields.py b/tastypie/fields.py index fe6ba87ef..597dc3370 100644 --- a/tastypie/fields.py +++ b/tastypie/fields.py @@ -653,9 +653,6 @@ def build_related_resource(self, value, request=None, related_obj=None, related_ elif isinstance(value, six.string_types): # We got a URI. Load the object and assign it. return self.resource_from_uri(self.fk_resource, value, **kwargs) - elif isinstance(value, Bundle): - # We got a valid bundle object, the RelatedField had full=True - return value elif hasattr(value, 'items'): # We've got a data dictionary. # Since this leads to creation, this is the only one of these