I am using django-taggit for tagging. I have django-tastypie REST resource for the same object.
While exposing the REST resource, it doesn’t fetch the tag field(e.g. equivalent to model.tags.all()).
Is there anything special needs to be done?
I wanted to perform GET and POST operation on object model and retrieve and insert the tags.
Can some one please point to the sample setup to return the tag objects? I have referred to gist here, however not able to understand that how you can retrieve associated tags when querying model.
Thanks for you help.
First make a
TagResource:Then in your resource that got tags:
It should work.
UPDATE
In order to filter the tag, you have to filter it through
TagResource, assuming your api name isv1, the url is :/api/v1/tag/?slug=anytagyouwant&format=jsonAbove url is for like : ‘is
anytagyouwantexist?’for ‘get all foo that have
anytagyouwanttag’/api/v1/foo/?tags__slug=anytagyouwant&format=jsonNote, to be able to filter for certain fields, you have to declare it in your resource, using
FooResourceas an example :