Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

145
Views
Django and DRF-DataTables - Fixing Filtering Behavior

I am using DRF-DataTables to create a browsable table on the client side.

The model I am working with contains some nullable boolean fields like so:

models.py

class Record(...):
    name = models.CharField(..., blank=True, null=True)
    is_active = models.BooleanField(blank=True, null=True)

The table is rendered with serverside=true, however there is some unwanted behavior when trying to filter on the is_active column:

  1. filtering with "True" or "true" correctly retrieves only the records where is_active=True
  2. filtering with "False" (or any iteration where the 'F' is capitalized) correctly retrieves the records where is_active=False
  3. filtering with "false" incorrectly retrieves all records (but "fals" pulls the records where is_active=False)

Furthermore - there does not seem to be anyway to filter for the records where is_active=None or name=None

An idea solution would be to override the filtering logic by writing my own FilterSet, however when trying to follow the docs I run into this error:

views.py

class RecordGlobalFilter(...):

    name = GlobalCharFilter(lookup_expr='icontains')

    class Meta:
        model = Record
        fields = '__all__'


class RecordViewSet(...):
    
    ...
    
    filter_backends = [DatatablesFilterBackend]
    filterset_class = RecordFilter

The error:

AttributeError: type object 'RecordFilter' has no attribute '_meta'
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!