def get(self, request, obj_id): result = Result() obj = Match.objects.get(pk=obj_id) result.isSuccess = True result.setValue(obj.json()) return JsonResponse(result)
def index(self, request): self._processRequest(request) result = Result() qs = Q() for n in self.user.teams.all(): qs |= Q(red=n) qs |= Q(blu=n) matches = Match.objects.filter(qs, state=Match.Open) obj = [m.json() for m in matches] result.isSuccess = True result.setValue(obj) return JsonResponse(result)