Revision 533ce0c8
Added by Benjamin Dauvergne over 12 years ago
calebasse/dossiers/lookups.py | ||
---|---|---|
1 | 1 |
|
2 | 2 |
from ajax_select import LookupChannel |
3 | 3 |
from calebasse.dossiers.models import PatientRecord, PatientAddress |
4 |
from django.core.exceptions import PermissionDenied |
|
4 | 5 |
|
5 | 6 |
class PatientRecordLookup(LookupChannel): |
6 |
|
|
7 | 7 |
model = PatientRecord |
8 | 8 |
search_field = 'display_name' |
9 | 9 |
|
... | ... | |
14 | 14 |
qs = qs.filter(service__name=service) |
15 | 15 |
return qs |
16 | 16 |
|
17 |
def check_auth(self, request): |
|
18 |
if not request.user.is_authenticated(): |
|
19 |
raise PermissionDenied |
|
17 | 20 |
|
18 | 21 |
class PatientAddressLookup(LookupChannel): |
19 |
|
|
20 | 22 |
model = PatientAddress |
21 | 23 |
search_field = 'display_name' |
22 | 24 |
|
... | ... | |
25 | 27 |
if request.session.has_key('patientrecord_id'): |
26 | 28 |
qs = qs.filter(patientcontact__id=request.session['patientrecord_id']) |
27 | 29 |
return qs |
30 |
|
|
31 |
def check_auth(self, request): |
|
32 |
if not request.user.is_authenticated(): |
|
33 |
raise PermissionDenied |
Also available in: Unified diff
dossiers: fix lookups for non admin users (fixes #2014)