Merge remote-tracking branch 'origin/master'

This commit is contained in:
Bob 2020-10-15 09:08:17 +08:00
commit b3658249ee
2 changed files with 2 additions and 1 deletions

View File

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