Revision 9f39f12f
Added by Jérôme Schneider almost 11 years ago
calebasse/dossiers/lookups.py | ||
---|---|---|
1 | 1 |
# -*- coding: utf-8 -*- |
2 | 2 |
|
3 |
from ajax_select import LookupChannel
|
|
3 |
from calebasse.lookups import CalebasseLookup
|
|
4 | 4 |
from calebasse.dossiers.models import PatientRecord, PatientAddress |
5 | 5 |
from django.core.exceptions import PermissionDenied |
6 | 6 |
from itertools import chain |
7 | 7 |
|
8 |
class PatientRecordLookup(LookupChannel):
|
|
8 |
class PatientRecordLookup(CalebasseLookup):
|
|
9 | 9 |
model = PatientRecord |
10 | 10 |
search_field = 'last_name' |
11 | 11 |
homonym = False |
... | ... | |
58 | 58 |
text += u')' |
59 | 59 |
return unicode(text) |
60 | 60 |
|
61 |
def check_auth(self, request): |
|
62 |
if not request.user.is_authenticated(): |
|
63 |
raise PermissionDenied |
|
64 |
|
|
65 |
class PatientAddressLookup(LookupChannel): |
|
61 |
class PatientAddressLookup(CalebasseLookup): |
|
66 | 62 |
model = PatientAddress |
67 | 63 |
search_field = 'display_name' |
68 | 64 |
|
... | ... | |
72 | 68 |
qs = qs.filter(patientcontact__id=request.session['patientrecord_id']) |
73 | 69 |
return qs |
74 | 70 |
|
75 |
def check_auth(self, request): |
|
76 |
if not request.user.is_authenticated(): |
|
77 |
raise PermissionDenied |
calebasse/lookups.py | ||
---|---|---|
1 |
|
|
2 |
from ajax_select import LookupChannel |
|
3 |
|
|
4 |
class CalebasseLookup(LookupChannel): |
|
5 |
|
|
6 |
def check_auth(self,request): |
|
7 |
if not request.user.is_authenticated(): |
|
8 |
raise PermissionDenied |
|
9 |
|
calebasse/personnes/lookup.py | ||
---|---|---|
1 | 1 |
|
2 |
from ajax_select import LookupChannel |
|
2 |
from calebasse.lookups import CalebasseLookup |
|
3 |
|
|
3 | 4 |
from models import Worker |
4 | 5 |
|
5 |
class WorkerLookup(LookupChannel):
|
|
6 |
class WorkerLookup(CalebasseLookup):
|
|
6 | 7 |
model = Worker |
7 | 8 |
search_field = 'display_name' |
8 | 9 |
|
calebasse/ressources/lookups.py | ||
---|---|---|
1 | 1 |
import itertools |
2 | 2 |
|
3 |
from ajax_select import LookupChannel
|
|
3 |
from calebasse.lookups import CalebasseLookup
|
|
4 | 4 |
from calebasse.personnes.models import Worker |
5 | 5 |
from calebasse.ressources.models import Service |
6 | 6 |
|
... | ... | |
16 | 16 |
return u'Groupe: %s' % self.label |
17 | 17 |
|
18 | 18 |
|
19 |
class WorkerOrGroupLookup(LookupChannel):
|
|
19 |
class WorkerOrGroupLookup(CalebasseLookup):
|
|
20 | 20 |
model = Worker |
21 | 21 |
search_field = 'last_name' |
22 | 22 |
|
Also available in: Unified diff
allow access to ajax lookup for everyone
Closes #4072