我有一个像这样的for循环:
for k in file1:
shared_username = User.objects.filter(id__in= Share.objects.filter(users_id = log_id, files__file_name=k).values_list('shared_user_id', flat=True))
shared_username = [User.objects.filter(id__in= Share.objects.filter(users_id = log_id, files__file_name=k).values_list('shared_user_id', flat=True)) for k in file1]
但我得到空条目。
答案 0 :(得分:1)
您不应在此类构造中使用相等运算符。也许试试:
a_list = [User.objects.filter(id__in= Share.objects.filter(users_id = log_id, files__file_name=k).values_list('shared_user_id', flat=True)) for k in file1]