Search code examples
djangotastypie

tastypie ignore case on filtering


I have added some filters on my Resource

filtering = {
    "user" : ALL_WITH_RELATIONS, # to access FK filters
    "state": ALL,
    "job_type": ALL,
}

calling is as http://127.0.0.1:8000/profile/?state=Alaska

Can I modify it so that the filters can ignore case


Solution

  • You can call

    http://127.0.0.1:8000/profile/?state__iexact=Alaska
    

    Default lookup method is exact. iexact is a case-insensitive exact.

    Filtering in Tastypie looks like filtering in Django ORM. Every field lookups works.