Skip to content

Commit

Permalink
Merge pull request django-tastypie#1066 from damycra/doc-fixes
Browse files Browse the repository at this point in the history
Resource doc fixes, tiny change to fields.py
  • Loading branch information
toastdriven committed Nov 3, 2013
2 parents 1ec6972 + fa9a107 commit 75ac54d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
14 changes: 7 additions & 7 deletions docs/resources.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down Expand Up @@ -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``
----------
Expand Down Expand Up @@ -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
<http://haystacksearch.org>` rather than simple database queries) your
<http://haystacksearch.org/>`_ 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::
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions tastypie/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 75ac54d

Please sign in to comment.