Again I have same problem with query set
Following is the list for exclude some pattern in my query.
list = ['AW', 'cons', 'AR', 'AA', 'S1']
I am using the list contents one by one from the list and then using in below query set
objects_list = XeroLabourIndirect.objects.exclude(
Q(job_num__istartswith='AW') |
Q(job_num__istartswith='cons') |
Q(job_num__istartswith='AR') |
Q(job_num__istartswith='S1') |
Q(job_num__istartswith='AA')) if obj else None
Instead of using the list content one by one in query set, I want to use my list inside query set with list comprehension method and iterate inside the query and then I have to get the resultant queryset.
For that what I have to do?
I tried something but all ends in syntax error, or some other errors. Please give some solution for my problem