add message

This commit is contained in:
baoliang 2020-11-02 08:03:22 +08:00
parent 8e2bbbdc8b
commit f663ca13bc
2 changed files with 3 additions and 1 deletions

View File

@ -74,7 +74,7 @@ def group_manager(request):
group_id = request.GET.get('group_id') group_id = request.GET.get('group_id')
if not group_id: if not group_id:
return JsonResponse({'status': 'error', 'message': '参数错误'}) return JsonResponse({'status': 'error', 'message': '参数错误'})
managers = Userprofile.objects.filter(user__group_admin__group_id=group_id) managers = Userprofile.objects.filter(user__group_admin__group_id=group_id).order_by('user__group_admin__created')
results = [] results = []
for m in managers: for m in managers:
result = dict() result = dict()
@ -82,6 +82,7 @@ def group_manager(request):
result['name'] = m.name result['name'] = m.name
result['thumbnail'] = request.build_absolute_uri( result['thumbnail'] = request.build_absolute_uri(
m.image.url) if m.image else None m.image.url) if m.image else None
result['phone'] = m.user.username
result['organization'] = m.organization.name result['organization'] = m.organization.name
results.append(result) results.append(result)
return JsonResponse({'status': 'success', 'message': results}, safe=False) return JsonResponse({'status': 'success', 'message': results}, safe=False)
@ -103,6 +104,7 @@ def group_member(request):
result['name'] = m.name result['name'] = m.name
result['thumbnail'] = request.build_absolute_uri( result['thumbnail'] = request.build_absolute_uri(
m.image.url) if m.image else None m.image.url) if m.image else None
result['phone'] = m.user.username
result['organization'] = m.organization.name result['organization'] = m.organization.name
results.append(result) results.append(result)
return JsonResponse({'status': 'success', 'message': results}, safe=False) return JsonResponse({'status': 'success', 'message': results}, safe=False)