I have the following object result from query set on a model as follow :
ddd = Post_Sub_Category.objects.filter(category_name__category_name__iexact=dd).values_list('sub_category_name', flat=True)
the query set I obtained:
<QuerySet ['car', 'spare parts', 'truck', 'motor cycle']>
then tried:
print(ddd.values('sub_category_name'))
I obtained the following result:
<QuerySet [<Post_Sub_Category: car>, <Post_Sub_Category: spare parts>, <Post_Sub_Category: truck>, <Post_Sub_Category: motor cycle>]
How to access the values only and make list of them as string :['car','spare parts','truck','motor cycle'].
the first query set seems that it gave me what I want. However, When I use following if statement. it does not executed:
if 'car' in ddd:
# do some thing
as you can see 'car' should be in the list. so, I could not understand why the if statement has not been executed.
any help or suggestion?