Project

General

Profile

« Previous | Next » 

Revision 92ea6229

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

Enable django debug toolbar and improve agenda view

View differences:

calebasse/agenda/managers.py
96 96
        date = date or datetime.now()
97 97
        start = datetime(date.year, date.month, date.day)
98 98
        end = start.replace(hour=23, minute=59, second=59)
99
        qs = self.filter(
99
        qs = self.select_related('event').filter(
100 100
            models.Q(
101 101
                start_time__gte=start,
102 102
                start_time__lte=end,
calebasse/agenda/views.py
35 35
                '6': u'samedi'
36 36
                }
37 37
        weekday = weekday_mapping[context['date'].strftime("%w")]
38
        time_tables = TimeTable.objects.select_related().\
38
        time_tables = TimeTable.objects.select_related('worker').\
39 39
                filter(service=self.service).\
40 40
                filter(weekday=weekday).\
41 41
                filter(start_date__lte=context['date']).\
......
54 54

  
55 55
        for worker in workers:
56 56
            time_tables_worker = [tt for tt in time_tables if tt.worker.id == worker.id]
57
            occurrences_worker = [o for o in occurrences for id in o.event.participants.values_list('id') if id[0] == worker.id]
57
            occurrences_worker = [o for o in occurrences if worker.id in o.event.participants.values_list('id', flat=True)]
58 58
            context['workers_agenda'].append({'worker': worker,
59 59
                    'appointments': get_daily_appointments(context['date'], worker, self.service,
60 60
                        time_tables_worker, occurrences_worker)})
calebasse/settings/common.py
103 103
    'django.middleware.csrf.CsrfViewMiddleware',
104 104
    'django.contrib.auth.middleware.AuthenticationMiddleware',
105 105
    'django.contrib.messages.middleware.MessageMiddleware',
106
    'debug_toolbar.middleware.DebugToolbarMiddleware',
106 107
    # Uncomment the next line for simple clickjacking protection:
107 108
    # 'django.middleware.clickjacking.XFrameOptionsMiddleware',
108 109
)
......
143 144
    'south',
144 145
    'django.contrib.admin',
145 146
    'ajax_select',
147
    'debug_toolbar',
146 148
    'widget_tweaks',
147 149
    # Uncomment the next line to enable admin documentation:
148 150
    # 'django.contrib.admindocs',
......
154 156
    'calebasse.ressources',
155 157
)
156 158

  
159
INTERNAL_IPS=('127.0.0.1',)
160

  
157 161
# A sample logging configuration. The only tangible logging
158 162
# performed by this configuration is to send an email to
159 163
# the site admins on every HTTP 500 error when DEBUG=False.
setup.py
21 21
            'django-widget-tweaks < 1.2.0',
22 22
            'django-tastypie>=0.9, < 1.0',
23 23
            'interval == 1.0.0',
24
            'django-debug-toolbar',
24 25
        ],
25 26
        dependency_links = [
26 27
            'http://django-swingtime.googlecode.com/files/django-swingtime-0.2.1.tar.gz#egg=django-swingtime-0.2.1',

Also available in: Unified diff