|
@ -2,6 +2,7 @@ from datetime import datetime |
|
|
from re import sub |
|
|
from re import sub |
|
|
|
|
|
|
|
|
from django.contrib import messages |
|
|
from django.contrib import messages |
|
|
|
|
|
from django.contrib.auth.decorators import user_passes_test |
|
|
from django.contrib.auth.mixins import PermissionRequiredMixin |
|
|
from django.contrib.auth.mixins import PermissionRequiredMixin |
|
|
from django.core.exceptions import ObjectDoesNotExist, ValidationError |
|
|
from django.core.exceptions import ObjectDoesNotExist, ValidationError |
|
|
from django.core.urlresolvers import reverse |
|
|
from django.core.urlresolvers import reverse |
|
@ -43,6 +44,10 @@ OrdemDiaCrud = Crud.build(OrdemDia, '') |
|
|
RegistroVotacaoCrud = Crud.build(RegistroVotacao, '') |
|
|
RegistroVotacaoCrud = Crud.build(RegistroVotacao, '') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def check_permission(user): |
|
|
|
|
|
return user.has_perms(permissoes_sessao()) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def reordernar_materias_expediente(request, pk): |
|
|
def reordernar_materias_expediente(request, pk): |
|
|
expedientes = ExpedienteMateria.objects.filter( |
|
|
expedientes = ExpedienteMateria.objects.filter( |
|
|
sessao_plenaria_id=pk) |
|
|
sessao_plenaria_id=pk) |
|
@ -449,15 +454,14 @@ class PresencaMixin: |
|
|
yield (parlamentar, False) |
|
|
yield (parlamentar, False) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class PresencaView(PermissionRequiredMixin, |
|
|
class PresencaView(FormMixin, |
|
|
FormMixin, |
|
|
|
|
|
PresencaMixin, |
|
|
PresencaMixin, |
|
|
SessaoCrud.CrudDetailView): |
|
|
SessaoCrud.CrudDetailView): |
|
|
template_name = 'sessao/presenca.html' |
|
|
template_name = 'sessao/presenca.html' |
|
|
form_class = PresencaForm |
|
|
form_class = PresencaForm |
|
|
model = SessaoPlenaria |
|
|
model = SessaoPlenaria |
|
|
permission_required = permissoes_sessao() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@user_passes_test(check_permission) |
|
|
def post(self, request, *args, **kwargs): |
|
|
def post(self, request, *args, **kwargs): |
|
|
self.object = self.get_object() |
|
|
self.object = self.get_object() |
|
|
form = self.get_form() |
|
|
form = self.get_form() |
|
|