Revision e4313fa2
Fixed exception in event add page
crm/robocrm/views.py | ||
---|---|---|
1 | 1 |
# Create your views here. |
2 | 2 |
from django.http import HttpResponse, Http404 |
3 |
from django.core.exceptions import PermissionDenied |
|
3 |
from django.core.exceptions import PermissionDenied, DoesNotExist
|
|
4 | 4 |
from django.contrib.auth import authenticate, login |
5 | 5 |
from robocrm.models import * |
6 | 6 |
|
... | ... | |
50 | 50 |
imgurl = '' # TODO find url based on tstart |
51 | 51 |
machine_id = int(request.POST['machine_id']) |
52 | 52 |
|
53 |
robouser = RoboUser.objects.get(rfid__iexact=user_id) |
|
54 |
machine = Machine.objects.get(id__exact=machine_id) |
|
53 |
try: |
|
54 |
robouser = RoboUser.objects.get(rfid__iexact=user_id) |
|
55 |
except DoesNotExist: |
|
56 |
robouser = None |
|
57 |
|
|
58 |
try: |
|
59 |
machine = Machine.objects.get(id__exact=machine_id) |
|
60 |
except DoesNotExist: |
|
61 |
machine = None |
|
55 | 62 |
|
56 | 63 |
ev = Event(type='card', |
57 | 64 |
tstart=tstart, |
Also available in: Unified diff