|
@ -1,5 +1,6 @@ |
|
|
from datetime import date |
|
|
from datetime import date |
|
|
|
|
|
|
|
|
|
|
|
from django.contrib.auth.decorators import user_passes_test |
|
|
from django.core.exceptions import ObjectDoesNotExist |
|
|
from django.core.exceptions import ObjectDoesNotExist |
|
|
from django.http import HttpResponse, JsonResponse |
|
|
from django.http import HttpResponse, JsonResponse |
|
|
from django.shortcuts import render |
|
|
from django.shortcuts import render |
|
@ -11,12 +12,18 @@ from sapl.parlamentares.models import Filiacao |
|
|
from sapl.sessao.models import (ExpedienteMateria, OrdemDia, PresencaOrdemDia, |
|
|
from sapl.sessao.models import (ExpedienteMateria, OrdemDia, PresencaOrdemDia, |
|
|
RegistroVotacao, SessaoPlenaria, |
|
|
RegistroVotacao, SessaoPlenaria, |
|
|
SessaoPlenariaPresenca, VotoParlamentar) |
|
|
SessaoPlenariaPresenca, VotoParlamentar) |
|
|
|
|
|
from sapl.utils import permissoes_painel |
|
|
|
|
|
|
|
|
from .models import Cronometro |
|
|
from .models import Cronometro |
|
|
|
|
|
|
|
|
CronometroPainelCrud = Crud.build(Cronometro, '') |
|
|
CronometroPainelCrud = Crud.build(Cronometro, '') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def check_permission(user): |
|
|
|
|
|
return user.has_perms(permissoes_painel()) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@user_passes_test(check_permission) |
|
|
def controlador_painel(request): |
|
|
def controlador_painel(request): |
|
|
|
|
|
|
|
|
painel_created = Painel.objects.get_or_create(data_painel=date.today()) |
|
|
painel_created = Painel.objects.get_or_create(data_painel=date.today()) |
|
@ -37,23 +44,28 @@ def controlador_painel(request): |
|
|
return render(request, 'painel/controlador.html', context) |
|
|
return render(request, 'painel/controlador.html', context) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@user_passes_test(check_permission) |
|
|
def painel_view(request, pk): |
|
|
def painel_view(request, pk): |
|
|
context = {'head_title': str(_('Painel Plenário')), 'sessao_id': pk} |
|
|
context = {'head_title': str(_('Painel Plenário')), 'sessao_id': pk} |
|
|
return render(request, 'painel/index.html', context) |
|
|
return render(request, 'painel/index.html', context) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@user_passes_test(check_permission) |
|
|
def painel_mensagem_view(request): |
|
|
def painel_mensagem_view(request): |
|
|
return render(request, 'painel/mensagem.html') |
|
|
return render(request, 'painel/mensagem.html') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@user_passes_test(check_permission) |
|
|
def painel_parlamentar_view(request): |
|
|
def painel_parlamentar_view(request): |
|
|
return render(request, 'painel/parlamentares.html') |
|
|
return render(request, 'painel/parlamentares.html') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@user_passes_test(check_permission) |
|
|
def painel_votacao_view(request): |
|
|
def painel_votacao_view(request): |
|
|
return render(request, 'painel/votacao.html') |
|
|
return render(request, 'painel/votacao.html') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@user_passes_test(check_permission) |
|
|
def cronometro_painel(request): |
|
|
def cronometro_painel(request): |
|
|
request.session[request.GET['tipo']] = request.GET['action'] |
|
|
request.session[request.GET['tipo']] = request.GET['action'] |
|
|
return HttpResponse({}) |
|
|
return HttpResponse({}) |
|
@ -316,6 +328,7 @@ def get_votos_nominal(response, materia): |
|
|
return response |
|
|
return response |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@user_passes_test(check_permission) |
|
|
def get_dados_painel(request, pk): |
|
|
def get_dados_painel(request, pk): |
|
|
sessao = SessaoPlenaria.objects.get(id=pk) |
|
|
sessao = SessaoPlenaria.objects.get(id=pk) |
|
|
cronometro_discurso = get_cronometro_status(request, 'discurso') |
|
|
cronometro_discurso = get_cronometro_status(request, 'discurso') |
|
|