Commit 6e1c53a0 authored by haowang's avatar haowang

user list add gender filter

parent db465f29
...@@ -19,13 +19,16 @@ from utils.pic_tools import tailor_image ...@@ -19,13 +19,16 @@ from utils.pic_tools import tailor_image
class UserListView(APIView): class UserListView(APIView):
def get(self, request): def get(self, request):
pictorial_id = request.GET.get('pictorial_id', '') pictorial_id = request.GET.get('pictorial_id', '')
gender = request.GET.get('gender', None)
page = int(request.GET.get('page', 1)) page = int(request.GET.get('page', 1))
limit = int(request.GET.get('limit', 10)) limit = int(request.GET.get('limit', 10))
filter = self.handle_filter(request.GET.get('filter', '{}')) filters = self.handle_filter(request.GET.get('filter', '{}'))
if pictorial_id: if pictorial_id:
filter.update({'pictorial_id': pictorial_id}) filters.update({'pictorial_id': pictorial_id})
if gender:
filters.update({'gender': gender})
try: try:
data = self.rpc['venus/sun/user/list'](offset=(page-1)*limit, limit=limit, filters=filter).unwrap() data = self.rpc['venus/sun/user/list'](offset=(page-1)*limit, limit=limit, filters=filters).unwrap()
except Exception as e: except Exception as e:
error_logger.error(u'获取用户列表失败%s', e) error_logger.error(u'获取用户列表失败%s', e)
raise raise
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment