tastypie: sequence item 0: expected string, function found
<pre><code>class ActionResource(ModelResource):
    #place = fields.ManyToManyField('restaurant.resource.PlaceResource', 'place', full=True, null=True)
    place = fields.ManyToManyField(PlaceResource,
                                attribute=lambda bundle: PlaceInfo.objects.filter(action=bundle.obj))

    class Meta:
        queryset = ActionInfo.objects.all()
        resource_name = 'action'

        filtering = {
            'place' : ALL_WITH_RELATIONS,
        }

class PlaceResource(ModelResource):
    location = fields.ManyToManyField(PlaceLocationResource, 'location')
    class Meta:
        queryset = PlaceInfo.objects.all()
        resource_name = 'place'

        filtering = {
            'id' : ALL,
        }
</code></pre>

<p>This is my resource.py. With this code i want to filter places with some id:</p>

<pre><code>http://localhost/api/v1/action/?place__id=2&amp;format=json
</code></pre>

<p>By action id i can find only one place, action is uniqe for place. With this url i get error: </p>

<pre><code>sequence item 0: expected string, function found
</code></pre>

<p>Django models look like PlaceModel has ManyToMany field with reference to ActionModel</p>

<pre><code>http://localhost/api/v1/action/2/?format=json
</code></pre>

<p>Gives me normal json with reference to places</p>

<p><strong>Additional:</strong></p>

<p>My Django models:</p>

<pre><code>class ActionInfo(models.Model):
    name        = models.ForeignKey(ActionName,     related_name="title",    on_delete=models.CASCADE, null=True, blank=True)

class PlaceInfo(models.Model):
    name            = models.ForeignKey(PlaceName, related_name="title", on_delete=models
</code></pre>

<p>.CASCADE, null=True)
        action          = models.ManyToManyField(ActionInfo, related_name="action", blank=True)</p>

<p>I've fond that i must constract my resources like this:</p>

<pre><code>class ActionResource(ModelResource):
    place   = fields.ToOneField(PlaceResource, 'place')

class PlaceResource(ModelResource):
    location    = fields.ManyToManyField(PlaceLocationResource, 
    action = fields.ToManyField('menus.resources.ActionResource', 'action', full=True)
</code></pre>

<p>But with such code i getting:</p>

<pre><code>error: "The model '&amp;lt;ActionInfo: name&amp;gt;' has an empty attribute 'place' and doesn't allow a null value."
</code></pre>

<p><strong>Solve:</strong></p>

<pre><code>class ActionResource(ModelResource):
    place   = fields.ToManyField(PlaceResource, 'action', null=True)
</code></pre>

<p>Now it workes with:</p>

<pre><code>http://localhost/api/v1/action/?place=1&amp;format=json
</code></pre>

<p>Try setting <code>ActionResource.place.attribute</code> equal to the name (or reverse name, depending on your models) of the relation.</p>

<pre><code>class ActionResource(ModelResource):
    place = fields.ToOneField(PlaceResource, 'reverse_name_here')
</code></pre>

python django tastypie