示例#1
0
    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)
示例#2
0
    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)