예제 #1
0
    def crud_search(self, request):
        start = 0
        limit = 25
        if 'getdata_in_qrystring' in request.GET:
            if 'start' in request.GET:
                start = request.GET['start']
            if 'limit' in request.GET:
                limit = request.GET['limit']
        
        topics = Topic.objects.filter(exercises__isnull=False).filter(exercises__periods__isnull=False)[start:start+limit]

        data = []
        for topic in topics:
            t_data = self.process_topic(topic, request.user)
            data.append(t_data)

        result = extjswrap(data, True, total=len(data))
        return SerializableResult(result)
예제 #2
0
    def crud_search(self, request):
        start = 0
        limit = 25
        if 'getdata_in_qrystring' in request.GET:
            if 'start' in request.GET:
                start = request.GET['start']
            if 'limit' in request.GET:
                limit = request.GET['limit']
        
        topics = Topic.objects.filter(exercises__isnull=False).filter(exercises__periods__isnull=False).distinct()[start:start+limit]

        data = []
        for topic in topics:
            t_data = self.process_topic(topic, request.user)
            data.append(t_data)

        result = extjswrap(data, True, total=len(data))
        return SerializableResult(result)
예제 #3
0
    def crud_search(self, request):
        start = 0
        limit = 25
        if 'getdata_in_qrystring' in request.GET:
            if 'start' in request.GET:
                start = request.GET['start']
            if 'limit' in request.GET:
                limit = request.GET['limit']
        
        periods = Period.objects.filter(exercises__isnull=False).annotate(exercisecount=Count('exercises'), totalpoints=Sum('exercises__points'))[start:start+limit]

        data = []
        for period in periods:
            p_data = self.process_period(period, request.user)
            data.append(p_data)

        result = extjswrap(data, True, total=len(data))
        return SerializableResult(result)
예제 #4
0
    def crud_search(self, request):
        start = 0
        limit = 25
        if 'getdata_in_qrystring' in request.GET:
            if 'start' in request.GET:
                start = request.GET['start']
            if 'limit' in request.GET:
                limit = request.GET['limit']
        
        periods = Period.objects.filter(exercises__isnull=False).annotate(exercisecount=Count('exercises'), totalpoints=Sum('exercises__points'))[start:start+limit]

        data = []
        for period in periods:
            p_data = self.process_period(period, request.user)
            data.append(p_data)

        result = extjswrap(data, True, total=len(data))
        return SerializableResult(result)
예제 #5
0
 def crud_read(self, request, id):
     topic = Topic.objects.get(id=id)
     data = [self.process_topic(topic, request.user)]
     result = extjswrap(data, True, total=1)
     return SerializableResult(result)
예제 #6
0
 def crud_read(self, request, id):
     topic = Topic.objects.get(id=id)
     data = [self.process_topic(topic, request.user)]
     result = extjswrap(data, True, total=1)
     return SerializableResult(result)
예제 #7
0
 def crud_read(self, request, id):
     period = Period.objects.annotate(exercisecount=Count('exercises'), totalpoints=Sum('exercises__points')).get(id=id)
     data = [self.process_period(period, request.user)]
     result = extjswrap(data, True, total=1)
     return SerializableResult(result)
예제 #8
0
 def crud_read(self, request, id):
     period = Period.objects.annotate(exercisecount=Count('exercises'), totalpoints=Sum('exercises__points')).get(id=id)
     data = [self.process_period(period, request.user)]
     result = extjswrap(data, True, total=1)
     return SerializableResult(result)