2019-11-13 09:54:59 +00:00
|
|
|
from django.db.models import Q
|
2019-11-27 03:18:32 +00:00
|
|
|
from django.http import HttpResponse
|
2019-09-05 09:10:53 +00:00
|
|
|
from django.shortcuts import render
|
|
|
|
|
|
|
|
# Create your views here.
|
2019-11-27 03:18:32 +00:00
|
|
|
from dwebsocket import require_websocket
|
|
|
|
|
2019-11-13 09:54:59 +00:00
|
|
|
from dashboard.models import Points
|
|
|
|
|
2019-09-05 09:10:53 +00:00
|
|
|
|
2019-09-09 01:32:35 +00:00
|
|
|
def index_1(request):
|
2019-11-20 02:56:36 +00:00
|
|
|
return render(request, 'dashboard/index.html')
|
2019-09-09 01:32:35 +00:00
|
|
|
|
2019-11-13 09:54:59 +00:00
|
|
|
|
2019-09-09 01:32:35 +00:00
|
|
|
def index_2(request):
|
2019-11-13 09:54:59 +00:00
|
|
|
return render(request, 'dashboard/index_2.html')
|
|
|
|
|
|
|
|
|
|
|
|
def points_search_by_keywords(request):
|
|
|
|
query_set = Points.objects.filter(deleted=False)
|
|
|
|
keywords = request.GET.get('keyword')
|
|
|
|
if len(keywords) != 0:
|
|
|
|
topten_list = query_set.filter(Q(sn__contains=keywords))
|
|
|
|
print(str(topten_list))
|
|
|
|
return render(request, 'dashboard/results_by_keywords.html', {'topten_list': topten_list})
|
|
|
|
|
|
|
|
def points_search_by_sn(request):
|
|
|
|
sn = request.GET.get('sn')
|
|
|
|
if len(sn) != 0 :
|
|
|
|
points = Points.objects.get(sn=sn)
|
2019-11-27 03:18:32 +00:00
|
|
|
return render(request,'dashboard/index.html',{'points':points})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|