root / crm / robocrm / views.py @ e680f143
History | View | Annotate | Download (509 Bytes)
1 | 988e217a | Julian Binder | # Create your views here.
|
---|---|---|---|
2 | 7cc67b05 | Julian Binder | from django.http import HttpResponse |
3 | 66cc3ee3 | Julian Binder | from robocrm.models import * |
4 | 7cc67b05 | Julian Binder | |
5 | def index(request): |
||
6 | return HttpResponse("Hello again, world!") |
||
7 | 314bdec9 | Julian Binder | |
8 | 66cc3ee3 | Julian Binder | def roboauth(request, rfid_tag, mach_num): |
9 | # return HttpResponse("Hello, world!")
|
||
10 | r = RoboUser.objects.filter(rfid=rfid_tag) |
||
11 | if r.count() > 0: |
||
12 | us = r[0]
|
||
13 | else:
|
||
14 | return HttpResponse("0") |
||
15 | auth_machines = us.machines.filter(id=mach_num) |
||
16 | if auth_machines.count() > 0 : |
||
17 | return HttpResponse("1") |
||
18 | else :
|
||
19 | return HttpResponse("0") |