How to add filters to a query dynamically in Django?
<p>In my viewSet I am doing a query,</p>

<pre><code>queryset= Books.objects.all();
</code></pre>

<p>Now from an ajax call I get my filter values from UI i.e. age,gender, etc. of auther.There will be a total of 5 filters.</p>

<p>Now the problem which I ran into is how am I going to add filters to my query(only those filters which have any value).</p>

<p>What I tried is I checked for individual filter value and did query, but that way it fails as if the user remove the filter value or add multiple filters.
Any better suggestion how to accomplish this?</p>