add message

This commit is contained in:
baoliang 2020-10-15 00:02:09 +08:00
parent 589839e175
commit e171dc5033
2 changed files with 2 additions and 1 deletions

View File

@ -34,12 +34,13 @@ def groups(request):
user_id = request.user.id
category = request.GET.get('category')
q = Group.objects.filter(Q(status=1), Q(
group_user__user__id=user_id) | Q(group_admin__user__id=user_id))
group_user__user__id=user_id) | Q(group_admin__user__id=user_id)).distinct()
groups = q.filter(classify=category) if category else q
results = []
for o in groups:
result = dict()
result['id'] = str(o.id)
print(o.id, o.name)
result['name'] = o.name
result['image'] = request.build_absolute_uri(o.image.url)
results.append(result)