Révision 3355038a
Ajouté par Jérôme Schneider il y a presque 10 ans
calebasse/dossiers/lookups.py | ||
---|---|---|
34 | 34 |
|
35 | 35 |
return chain(qs, closed) |
36 | 36 |
|
37 |
def format_match(self,obj): |
|
38 |
return self.format_item_display(texte) |
|
39 |
|
|
40 | 37 |
def get_result(self, obj): |
41 | 38 |
return self.format_item_display(obj) |
42 | 39 |
|
calebasse/ressources/lookups.py | ||
---|---|---|
1 |
# -*- coding: utf-8 -*- |
|
1 | 2 |
import itertools |
2 | 3 |
|
3 | 4 |
from calebasse.lookups import CalebasseLookup |
4 | 5 |
from calebasse.personnes.models import Worker |
5 |
from calebasse.ressources.models import Service |
|
6 |
from calebasse.ressources.models import Service, School
|
|
6 | 7 |
|
7 | 8 |
class FakeGroup: |
8 | 9 |
pk = None |
... | ... | |
56 | 57 |
|
57 | 58 |
class AllWorkerOrGroupLookup(WorkerOrGroupLookup): |
58 | 59 |
enabled = False |
60 |
|
|
61 |
class SchoolLookup(CalebasseLookup): |
|
62 |
model = School |
|
63 |
search_field = 'name' |
|
64 |
|
|
65 |
def get_result(self, obj): |
|
66 |
return self.format_item_display(obj) |
|
67 |
|
|
68 |
def format_match(self, obj): |
|
69 |
return self.format_item_display(obj) |
|
70 |
|
|
71 |
def format_item_display(self, obj): |
|
72 |
text = '' |
|
73 |
if obj.school_type.name != 'Inconnu': |
|
74 |
text = unicode(obj.school_type) + ' ' + obj.name |
|
75 |
else: |
|
76 |
text = obj.name |
|
77 |
if obj.address: |
|
78 |
text += " - " + obj.address |
|
79 |
if obj.private: |
|
80 |
text += " (Privé)" |
|
81 |
else: |
|
82 |
text += " (Public)" |
|
83 |
return text |
|
84 |
|
calebasse/settings.py | ||
---|---|---|
235 | 235 |
#'patientrecord' : {'model':'dossiers.PatientRecord', 'search_field':'display_name'} |
236 | 236 |
#'coordinators' : {'model':'dossiers.PatientRecord', 'search_field':'display_name'} |
237 | 237 |
'patientrecord' : ('calebasse.dossiers.lookups', 'PatientRecordLookup'), |
238 |
'school' : {'model':'ressources.School', 'search_field':'name'}, |
|
238 |
#'school' : {'model':'ressources.School', 'search_field':'name'}, |
|
239 |
'school' : ('calebasse.ressources.lookups', 'SchoolLookup'), |
|
239 | 240 |
'addresses' : ('calebasse.dossiers.lookups', 'PatientAddressLookup'), |
240 | 241 |
'worker-or-group' : ('calebasse.ressources.lookups', 'WorkerOrGroupLookup'), |
241 | 242 |
'all-worker-or-group' : ('calebasse.ressources.lookups', 'AllWorkerOrGroupLookup'), |
Formats disponibles : Unified diff
dossiers: add more details to school for a new socialisation schedule
Fixes #4149