Dynamic queryset

Django -- Posted on Aug. 22, 2017

Dynamic queryset class based view django

              
                def get_queryset(self):
   qs = super().get_queryset()
   model = self.model
   kwargs = dict((field, value) for field, value
                      in self.request.GET.items() if value)
   qs = model.objects.filter(**kwargs)
   return qs
                  
   
            

Related Posts