""" Q函数的使用"""
# 查询username 或者nicjname 都为zhangsan 的用户
# user_list = WeiboUser.objects.filter(username='zhangsan')
# user_list2 = WeiboUser.objects.filter(nickname='zhangsan')
# print(user_list)
# print(user_list2)
# name = request.GET.get('name', None)
# print(name)
# query = Q(username=name) | Q(nickname=name)
# user_list = WeiboUser.objects.filter(query)
# print(user_list)
# username 按用户名查询
# username = request.GET.get('username', None)
# query = Q()
# if username is not None:
# query = query & Q(username=username)
# # nickname 按昵称来查询
# nickname = request.GET.get('nickname', None)
# query = Q()
# if nickname is not None:
# query = query & Q(nickname=nickname)
# user_list_q2 = WeiboUser.objects.filter(query)
# print(user_list_q2)