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

349
Views
Django: Django_filters in a class-based views

I ask you if you know how put this filters :

class CoursesFilters(django_filters.FilterSet):
    class Meta:
        model   =  Courses
        exclude = ('description')  

in this class view :

class CoursesList(ListView):
    model         = Courses    
    template_name = 'courses_list.html'  

I used to build my applications using function-based views, and this is my first time use class-based views.
Any idea?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

django-filters has a FilterView [readthedocs.io] that can be used:

from django_filters.views import FilterView

class CoursesList(FilterView):
    model = Courses    
    template_name = 'courses_list.html' 
    filterset_class = CoursesFilters

The filterset_class specifies the FilterSet that. The filter is passed to the template as filter. You thus can render a {{ filter.form }} in the template.

over 4 years ago · Santiago Trujillo Report
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!