Rappels: liste seulement chercheur, et ajout permission
[auf_savoirs_en_partage_django.git] / auf_savoirs_en_partage / rappels / views.py
CommitLineData
c4312cce
PP
1# -*- coding: utf-8 -*-
2
3from django.shortcuts import render_to_response
4from django.template import RequestContext
5from django.db.models import Count
6from django.contrib.auth.decorators import permission_required
7from django.contrib.auth.models import User
8
9
e4aeae54 10@permission_required('rappels.rappels')
c4312cce
PP
11def admin_rappels(request):
12
e4aeae54 13 chercheurs = User.objects.exclude(chercheur__exact=None).extra(select={'year': "EXTRACT(year FROM last_login)", 'month': "EXTRACT(month FROM last_login)"}).values('year', 'month').annotate(total=Count('username')).order_by('year', 'month')
c4312cce
PP
14
15 return render_to_response('admin/rappels/rappels.html', {
16 'chercheurs': chercheurs
17 }, context_instance=RequestContext(request))