Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8891819
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T22:50:15+00:00 2026-06-14T22:50:15+00:00

I am using django-taggit for tagging. I have django-tastypie REST resource for the same

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T22:50:17+00:00Added an answer on June 14, 2026 at 10:50 pm

    First make a TagResource :

    from taggit.models import Tag
    
    class TagResource(ModelResource):
        class Meta:
            queryset = Tag.objects.all()
    

    Then in your resource that got tags:

    class FooResource(ModelResource):
    
        tags = fields.ToManyField(TagResource, 'tags', # if your tag field is 'tags'
                                  full = True)
    
        class Meta:
            queryset = Foo.objects.all()
    

    It should work.

    UPDATE

    In order to filter the tag, you have to filter it through TagResource, assuming your api name is v1, the url is :

    /api/v1/tag/?slug=anytagyouwant&format=json

    Above url is for like : ‘is anytagyouwant exist?’

    for ‘get all foo that have anytagyouwant tag’

    /api/v1/foo/?tags__slug=anytagyouwant&format=json

    Note, to be able to filter for certain fields, you have to declare it in your resource, using FooResource as an example :

    from tastypie.resources import ModelResource, ALL, ALL_WITH_RELATIONS
    
    class FooResource(ModelResource):
    
        tags = fields.ToManyField(TagResource, 'tags', # if your tag field is 'tags'
                                  full = True)
    
        class Meta:
            queryset = Foo.objects.all()
            filtering = dict(
                tags = ALL,
                # or 
                tags = ALL_WITH_RELATIONS,
            )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an object that is tagged using django-taggit . If I wanted to
I'm using django-taggit. I am tagging action items and info items. I want to
I'm using django-taggit to tag items in a todo list app. I'm trying to
I'm using django-taggit to tag my to do records. class Action(models.Model): name = models.CharField(Action
I'm using django-taggit (see here ). This is what I have: forms.py from taggit.forms
I have a fairly simple model that uses Django Taggit for tagging. Everything works
Using Django 1.3 with PostgreSQL 9.0, I have a multi-step object creation function/view, where:
I am using django-tastypie to create a rest API for my webapp. I want
using django 1.4 I have a model with a datetimefield. I imported django.utils.timezone to
I using Django tagging project. That is was very stable project. Working on django

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.