python - searching all fields in a table in django -


How to find all the areas in a table using the filter section: table.object.filter (Any area in the table

Thank you.

I agree with Alsaidar, but the answer to your question though :

  Import from django.db.models CharField Q field from django.db.models = [f for table._meta.fields if isinstance (f, CharField)] queries = [Q] (** {F. Name: SEARCH_TERM}) for field F] qs = Q () query for query: qs = qs | question Neither table.objects.filter (qs)  

Note: I have not tested this code, but you should meet a bit closer to your goal


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

jquery - SimpleModal Confirm fails to submit form -

php - Multiple Select with Explode: only returns the word "Array" -