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 8832237
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T08:28:59+00:00 2026-06-14T08:28:59+00:00

I am starting to use Django and tastypie, to interact with my database. So

  • 0

I am starting to use Django and tastypie, to interact with my database.

So I have a database with a number of tables, and I can set up filtering, so that I can use a URL like so, using chains of related Django objects to filter my results.

api/seq/mapping/?loadedwith__lane__flowcell__name=C16P5ACXX&loadedwith__lane__lane=8

the mapping resource is set up as follows:

class MappingResource(ModelResource):
    loadedwith = fields.ToOneField('sequencing.api.LoadedWithResource' , 'loadedwith' ) 
    class Meta:
        queryset = Mapping.objects.all()
        resource_name = 'mapping'
        allowed_methods = ['get' , 'post' , 'put' , 'patch' ,  'delete']
        authorization = Authorization()                        
        serializer = PrettyJSONSerializer()
        filtering = {
            'loadedwith': ALL_WITH_RELATIONS,
            'reference_filename' : ALL
        }

This all works fine, as I would expect it to.

Now I noticed a problem when I messed up the URL.
If I miss out one of the loadedwith objects on the chain e.g.

loadedwith__lane__lane=8

and instead use

lane__lane=8

so the url ends up as:

api/seq/mapping/?loadedwith__lane__flowcell__name=C16P5ACXX&loadedwith__lane__lane=8

Now this returns the results filtered by the first part:

loadedwith__lane__flowcell__name=C16P5ACXX

but basically ignoring the second part

lane__lane=8

I would have expected it to throw an error, or not return anything. Is there a way to configure tastypie to throw an error in this situation? (Or is this an expected behaviour for some reason I am unaware of)?

  • 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-14T08:29:00+00:00Added an answer on June 14, 2026 at 8:29 am

    default tastypie behaviour is to ignore filters that don’t match fields [1].

    The only way to alter this behaviour is to override ModelResource build_filters() method.

    [1] https://github.com/toastdriven/django-tastypie/blob/master/tastypie/resources.py#L1784

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just starting to use Ruby on Rails to see what its like. I have
I am starting to use Django and while I have read the book and
I'm starting to learn how to use Django on the Google App Engine. I
I am just starting to use Wix and would like to use heat to
I'm just starting to use Django for a personal project. What are the pros
I am just starting to use a web framework. I have decided I really
I have a Django project that uses Celery for running asynchronous tasks. I'm doing
Just starting to use Cruise Control, but can't seem to find anything on this
As someone who is just starting to use Django in my scarce time, I
I have a couple special use cases for Django admin, and I'm curious about

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.