agenda: order participants by last_name (fix #2376)

This commit is contained in:
Jérôme Schneider 2013-02-11 14:14:04 +01:00
parent 12f88210df
commit 3db8d98479
2 changed files with 14 additions and 27 deletions

View File

@ -33,10 +33,10 @@ class WorkerOrGroupLookup(LookupChannel):
if service:
kwargs = { "%s__icontains" % self.search_field : q }
group = FakeGroup('group:%s' % service.id, service.name)
return itertools.chain([group], self.model.objects.for_service(service.id).order_by(self.search_field))
return itertools.chain([group], self.model.objects.for_service(service.id).order_by('last_name'))
kwargs = { "%s__icontains" % self.search_field : q }
return self.model.objects.filter(enabled=True).filter(**kwargs).order_by(self.search_field)
return self.model.objects.filter(enabled=True).filter(**kwargs).order_by('last_name')
def get_result(self, obj):
return self.format_item_display(obj)

View File

@ -12,7 +12,7 @@ django.core.management.setup_environ(calebasse.settings)
from django.contrib.auth.models import User
from calebasse.actes.models import EventAct
#from calebasse.actes.models import EventAct
from calebasse.agenda.models import Event, EventType
from calebasse.dossiers.models import PatientRecord, Status, FileState
from calebasse.ressources.models import Service
@ -20,10 +20,10 @@ from calebasse.personnes.models import Worker, Holiday
from calebasse.ressources.models import WorkerType
# Configuration
db_path = "/home/jschneider/temp/20121219-174113/"
db_path = "/home/jschneider/apps/calebasse/scripts/20130104-213225/"
dbs = ["F_ST_ETIENNE_SESSAD_TED", "F_ST_ETIENNE_CMPP", "F_ST_ETIENNE_CAMSP", "F_ST_ETIENNE_SESSAD"]
tables = ["discipline", "intervenants", "dossiers", "rs", "notes", "ev", "conge"]
tables = ["rs", "rr"]
# Global mappers. This dicts are used to map a Faure id with a calebasse object.
@ -96,29 +96,16 @@ def dossiers_mapper(tables_data, service):
patient.save()
def rs_mapper(tables_data, service):
global dossiers
if service.name == "CMPP":
for line in tables_data['rs']:
if line['id'] == '32436':
print line
event_type = EventType.objects.get(
label=u"Rendez-vous patient"
)
for line in tables_data['rs']:
if dossiers.has_key(line['enfant_id']):
patient = dossiers[line['enfant_id']]
strdate = line['date_rdv'][:-13] + ' ' + line['heure'][11:-4]
date = datetime.strptime(strdate, "%Y-%m-%d %H:%M:%S")
# TODO: add act_type
# act_event = EventAct.objects.get_or_create(
# title=line['libelle'],
# event_type=event_type,
# patient=patient,
# act_type=act_type,
# date=date
# )
else:
# TODO: if no patient add event
pass
def rr_mapper(tables_data, service):
if service.name == "CMPP":
for line in tables_data['rr']:
if line['id'] == '650':
print line
def conge_mapper(tables_data, service):