Exemplo n.º 1
0
	def head(self, request, *args, **kwargs):
		with Session() as s:
			for t in Thread.gets(s, title=request.GET.get('title')):
				if t.records >=1:
					return HttpResponse()
				break
		return HttpResponseNotFound()
Exemplo n.º 2
0
	def get(self, request, *args, **kwargs):
		threads = []
		with Session() as s:
			result = Thread.gets(s,
					limit=intOrNone(request.GET.get('limit')),
					stime=intOrNone(request.GET.get('start_time')),
					etime=intOrNone(request.GET.get('end_time')),
					title=request.GET.get('title'),
					)
			for t in result:
				threads.append({
					'id': int(t.id),
					'title': t.title,
					'timestamp': int(datetime2timestamp(t.timestamp)),
					'records': int(t.records),
					})
		obj = {
				'threads': threads
				}
		return JsonResponse(obj)