Project

General

Profile

« Previous | Next » 

Revision 3db8d984

Added by Jérôme Schneider over 11 years ago

agenda: order participants by last_name (fix #2376)

View differences:

calebasse/ressources/lookups.py
33 33
        if service:
34 34
            kwargs = { "%s__icontains" % self.search_field : q }
35 35
            group = FakeGroup('group:%s' % service.id, service.name)
36
            return itertools.chain([group], self.model.objects.for_service(service.id).order_by(self.search_field))
36
            return itertools.chain([group], self.model.objects.for_service(service.id).order_by('last_name'))
37 37

  
38 38
        kwargs = { "%s__icontains" % self.search_field : q }
39
        return self.model.objects.filter(enabled=True).filter(**kwargs).order_by(self.search_field)
39
        return self.model.objects.filter(enabled=True).filter(**kwargs).order_by('last_name')
40 40

  
41 41
    def get_result(self, obj):
42 42
        return self.format_item_display(obj)
scripts/import_db.py
12 12

  
13 13
from django.contrib.auth.models import User
14 14

  
15
from calebasse.actes.models import EventAct
15
#from calebasse.actes.models import EventAct
16 16
from calebasse.agenda.models import Event, EventType
17 17
from calebasse.dossiers.models import PatientRecord, Status, FileState
18 18
from calebasse.ressources.models import Service
......
20 20
from calebasse.ressources.models import WorkerType
21 21

  
22 22
# Configuration
23
db_path = "/home/jschneider/temp/20121219-174113/"
23
db_path = "/home/jschneider/apps/calebasse/scripts/20130104-213225/"
24 24

  
25 25
dbs = ["F_ST_ETIENNE_SESSAD_TED", "F_ST_ETIENNE_CMPP", "F_ST_ETIENNE_CAMSP", "F_ST_ETIENNE_SESSAD"]
26
tables = ["discipline", "intervenants", "dossiers", "rs", "notes", "ev", "conge"]
26
tables = ["rs", "rr"]
27 27

  
28 28

  
29 29
# Global mappers. This dicts are used to map a Faure id with a calebasse object.
......
96 96
                patient.save()
97 97

  
98 98
def rs_mapper(tables_data, service):
99
    global dossiers
100

  
101
    event_type = EventType.objects.get(
102
                label=u"Rendez-vous patient"
103
                )
104

  
105
    for line in tables_data['rs']:
106
        if dossiers.has_key(line['enfant_id']):
107
            patient = dossiers[line['enfant_id']]
108
            strdate = line['date_rdv'][:-13] + ' ' + line['heure'][11:-4]
109
            date = datetime.strptime(strdate, "%Y-%m-%d %H:%M:%S")
110

  
111
             # TODO: add act_type
112
#            act_event = EventAct.objects.get_or_create(
113
#                    title=line['libelle'],
114
#                    event_type=event_type,
115
#                    patient=patient,
116
#                    act_type=act_type,
117
#                    date=date
118
#                    )
119
        else:
120
            # TODO: if no patient add event
121
            pass
99
    if service.name == "CMPP":
100
        for line in tables_data['rs']:
101
            if line['id'] == '32436':
102
                print line
103

  
104
def rr_mapper(tables_data, service):
105
    if service.name == "CMPP":
106
        for line in tables_data['rr']:
107
            if line['id'] == '650':
108
                print line
122 109

  
123 110

  
124 111
def conge_mapper(tables_data, service):

Also available in: Unified diff