Dynamic filter on Django query
<p>I want to search in a field given by user.</p>

<p>I have this so far:</p>

<pre><code>def search_engine(model, given_field, text):
    # Stuff
    result = model.objects.filter(given_field__icontains=text)
    return result
</code></pre>

<p>The "given_field" inside filter would be the parameter given in the function, which is a variable.</p>