Revision 8f66553c
Fixed problems with previous fix
crm/robocrm/models.py | ||
---|---|---|
96 | 96 |
type = models.CharField(max_length=30) |
97 | 97 |
tstart = models.DateTimeField() |
98 | 98 |
tend = models.DateTimeField() |
99 |
user = models.ForeignKey('RoboUser') |
|
99 |
user = models.ForeignKey('RoboUser', null=True)
|
|
100 | 100 |
succ = models.BooleanField(default=False) |
101 | 101 |
imgurl = models.URLField() |
102 | 102 |
machine = models.ForeignKey('Machine') |
... | ... | |
104 | 104 |
matuse = models.TextField() |
105 | 105 |
|
106 | 106 |
def __unicode__(self): |
107 |
return u'%s %s %s'%(self.type, self.user.user.username, self.succ) |
|
107 |
return u'%s %s %s'%(self.type, |
|
108 |
self.user.user.username if self.user else 'unknown', self.succ) |
|
108 | 109 |
|
109 | 110 |
# Project Model |
110 | 111 |
class Project(models.Model): |
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, DoesNotExist |
|
3 |
from django.core.exceptions import PermissionDenied, ObjectDoesNotExist
|
|
4 | 4 |
from django.contrib.auth import authenticate, login |
5 | 5 |
from robocrm.models import * |
6 | 6 |
|
... | ... | |
52 | 52 |
|
53 | 53 |
try: |
54 | 54 |
robouser = RoboUser.objects.get(rfid__iexact=user_id) |
55 |
except DoesNotExist: |
|
55 |
except ObjectDoesNotExist:
|
|
56 | 56 |
robouser = None |
57 | 57 |
|
58 |
try: |
|
59 |
machine = Machine.objects.get(id__exact=machine_id) |
|
60 |
except DoesNotExist: |
|
61 |
machine = None |
|
58 |
machine = Machine.objects.get(id__exact=machine_id) |
|
62 | 59 |
|
63 | 60 |
ev = Event(type='card', |
64 | 61 |
tstart=tstart, |
Also available in: Unified diff