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)
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)
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)
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)
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)