Rappels: liste seulement chercheur, et ajout permission
[auf_savoirs_en_partage_django.git] / auf_savoirs_en_partage / rappels / views.py
1 # -*- coding: utf-8 -*-
2
3 from django.shortcuts import render_to_response
4 from django.template import RequestContext
5 from django.db.models import Count
6 from django.contrib.auth.decorators import permission_required
7 from django.contrib.auth.models import User
8
9
10 @permission_required('rappels.rappels')
11 def admin_rappels(request):
12
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')
14
15 return render_to_response('admin/rappels/rappels.html', {
16 'chercheurs': chercheurs
17 }, context_instance=RequestContext(request))