dossiers: add more details to school for a new socialisation schedule
Fixes #4149
This commit is contained in:
parent
66d9afe6e6
commit
3355038a89
|
@ -34,9 +34,6 @@ class PatientRecordLookup(CalebasseLookup):
|
|||
|
||||
return chain(qs, closed)
|
||||
|
||||
def format_match(self,obj):
|
||||
return self.format_item_display(texte)
|
||||
|
||||
def get_result(self, obj):
|
||||
return self.format_item_display(obj)
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
import itertools
|
||||
|
||||
from calebasse.lookups import CalebasseLookup
|
||||
from calebasse.personnes.models import Worker
|
||||
from calebasse.ressources.models import Service
|
||||
from calebasse.ressources.models import Service, School
|
||||
|
||||
class FakeGroup:
|
||||
pk = None
|
||||
|
@ -56,3 +57,28 @@ class WorkerOrGroupLookup(CalebasseLookup):
|
|||
|
||||
class AllWorkerOrGroupLookup(WorkerOrGroupLookup):
|
||||
enabled = False
|
||||
|
||||
class SchoolLookup(CalebasseLookup):
|
||||
model = School
|
||||
search_field = 'name'
|
||||
|
||||
def get_result(self, obj):
|
||||
return self.format_item_display(obj)
|
||||
|
||||
def format_match(self, obj):
|
||||
return self.format_item_display(obj)
|
||||
|
||||
def format_item_display(self, obj):
|
||||
text = ''
|
||||
if obj.school_type.name != 'Inconnu':
|
||||
text = unicode(obj.school_type) + ' ' + obj.name
|
||||
else:
|
||||
text = obj.name
|
||||
if obj.address:
|
||||
text += " - " + obj.address
|
||||
if obj.private:
|
||||
text += " (Privé)"
|
||||
else:
|
||||
text += " (Public)"
|
||||
return text
|
||||
|
||||
|
|
|
@ -235,7 +235,8 @@ AJAX_LOOKUP_CHANNELS = {
|
|||
#'patientrecord' : {'model':'dossiers.PatientRecord', 'search_field':'display_name'}
|
||||
#'coordinators' : {'model':'dossiers.PatientRecord', 'search_field':'display_name'}
|
||||
'patientrecord' : ('calebasse.dossiers.lookups', 'PatientRecordLookup'),
|
||||
'school' : {'model':'ressources.School', 'search_field':'name'},
|
||||
#'school' : {'model':'ressources.School', 'search_field':'name'},
|
||||
'school' : ('calebasse.ressources.lookups', 'SchoolLookup'),
|
||||
'addresses' : ('calebasse.dossiers.lookups', 'PatientAddressLookup'),
|
||||
'worker-or-group' : ('calebasse.ressources.lookups', 'WorkerOrGroupLookup'),
|
||||
'all-worker-or-group' : ('calebasse.ressources.lookups', 'AllWorkerOrGroupLookup'),
|
||||
|
|
Reference in New Issue