Browse Source

1566 cadastro de reunioes (#1614)

* Adiciona a model, forms e views da reunião de comissão

* Adiciona a model reunião no map_rules

* Adiciona telas de cadastro de reunião

* Adiciona layouts e legacy

* Adiciona template, modifica o subnav e o ListView

* Resolve conflitos

* corrige form de reunião

* Troca Crud por MasterCrudDetail

* Adiciona template de cadastro de reunião

* Corrige Createview e Listview

* Ajusta comissoes

* Corrige a model e o layout da tela de criação

* Corrige o deleteview e o detailview

* FIX #1566

* Muda o layout do create de reunião

* Corrige layout e model de reunião

* HOT-FIX: tirar ipdb do materia/form

* Muda o layout do create de reunião

* ajusta campos timefield em reunião de comissões
pull/1741/head
Mariana Mendes 7 years ago
committed by Edward
parent
commit
bb6c382691
  1. 33
      sapl/comissoes/forms.py
  2. 18
      sapl/comissoes/legacy.yaml
  3. 44
      sapl/comissoes/migrations/0003_reuniao.py
  4. 16
      sapl/comissoes/migrations/0005_merge.py
  5. 25
      sapl/comissoes/migrations/0006_auto_20180227_0842.py
  6. 25
      sapl/comissoes/migrations/0007_auto_20180227_1025.py
  7. 25
      sapl/comissoes/migrations/0008_auto_20180227_1111.py
  8. 41
      sapl/comissoes/migrations/0009_auto_20180301_1011.py
  9. 25
      sapl/comissoes/migrations/0010_auto_20180306_0918.py
  10. 133
      sapl/comissoes/models.py
  11. 3
      sapl/comissoes/urls.py
  12. 57
      sapl/comissoes/views.py
  13. 2
      sapl/crispy_layout_mixin.py
  14. 1
      sapl/materia/forms.py
  15. 49
      sapl/redireciona_urls/views.py
  16. 1
      sapl/rules/map_rules.py
  17. 15
      sapl/templates/comissoes/layouts.yaml
  18. 8
      sapl/templates/comissoes/reunioes.html
  19. 2
      sapl/templates/comissoes/subnav.yaml

33
sapl/comissoes/forms.py

@ -3,9 +3,10 @@ from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError
from django.db import transaction from django.db import transaction
from django.db.models import Q from django.db.models import Q
from django.forms import ModelForm
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from sapl.base.models import Autor, TipoAutor from sapl.base.models import Autor, TipoAutor
from sapl.comissoes.models import Comissao, Composicao, Participacao from sapl.comissoes.models import Comissao, Composicao, Participacao, Reuniao
from sapl.parlamentares.models import Legislatura, Mandato, Parlamentar from sapl.parlamentares.models import Legislatura, Mandato, Parlamentar
@ -69,7 +70,8 @@ class ParticipacaoCreateForm(forms.ModelForm):
composicao = Composicao.objects.get(id=self.initial['parent_pk']) composicao = Composicao.objects.get(id=self.initial['parent_pk'])
participantes = composicao.participacao_set.all() participantes = composicao.participacao_set.all()
participantes_id = [p.parlamentar.id for p in participantes] participantes_id = [p.parlamentar.id for p in participantes]
parlamentares = Parlamentar.objects.all().exclude(id__in=participantes_id).order_by('nome_completo') parlamentares = Parlamentar.objects.all().exclude(
id__in=participantes_id).order_by('nome_completo')
parlamentares = [p for p in parlamentares if p.ativo] parlamentares = [p for p in parlamentares if p.ativo]
lista = [] lista = []
@ -142,3 +144,30 @@ class ComissaoForm(forms.ModelForm):
nome=nome nome=nome
) )
return comissao return comissao
class ReuniaoForm(ModelForm):
comissao = forms.ModelChoiceField(queryset=Comissao.objects.all(),
widget=forms.HiddenInput())
class Meta:
model = Reuniao
exclude = ['cod_andamento_reuniao']
widgets = {
'hora_fim': forms.TimeInput(format='%H:%M'),
'hora_inicio': forms.TimeInput(format='%H:%M'),
}
def clean(self):
super(ReuniaoForm, self).clean()
if self.errors:
return
if self.cleaned_data['hora_fim'] < self.cleaned_data['hora_inicio']:
msg = _('A hora de término da reunião não pode '
'ser menor que a de início')
raise ValidationError(msg)
return self.cleaned_data

18
sapl/comissoes/legacy.yaml

@ -43,3 +43,21 @@ Participacao (ComposicaoComissao):
observacao: obs_composicao observacao: obs_composicao
parlamentar: cod_parlamentar parlamentar: cod_parlamentar
titular: ind_titular titular: ind_titular
Reuniao:
periodo: periodo_reuniao
comissao: cod_comissao
tipo: tipo_comissao
numero: num_comissao
nome: nom_reuniao
tema: tem_reuniao
data: dat_reuniao
hora_inicio: hora_inicio_reuniao
hora_fim: hora_fim_reuniao
local_reuniao: local
observacao: obs_reuniao
ulr_audio: audio_reuniao
url_video: video_reuniao
upload_pauta: pauta_reuniao
upload_ata: ata_reuniao
upload_anexo: anexo_reuniao

44
sapl/comissoes/migrations/0003_reuniao.py

@ -0,0 +1,44 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.13 on 2017-11-23 13:07
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import sapl.comissoes.models
import sapl.utils
class Migration(migrations.Migration):
dependencies = [
('comissoes', '0002_auto_20170809_1236'),
]
operations = [
migrations.CreateModel(
name='Reuniao',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('numero', models.PositiveIntegerField(verbose_name='Número')),
('nome', models.CharField(max_length=100, verbose_name='Nome da Reunião')),
('tema', models.CharField(max_length=100, verbose_name='Tema da Reunião')),
('data', models.DateField(verbose_name='Data')),
('hora_inicio', models.CharField(max_length=5, verbose_name='Horário (hh:mm)')),
('hora_fim', models.CharField(max_length=5, verbose_name='Horário (hh:mm)')),
('local_reuniao', models.CharField(blank=True, max_length=100, verbose_name='Local Reunião')),
('observacao', models.CharField(blank=True, max_length=150, verbose_name='Observação')),
('url_audio', models.URLField(blank=True, max_length=150, verbose_name='URL Arquivo Áudio (Formatos MP3 / AAC)')),
('url_video', models.URLField(blank=True, max_length=150, verbose_name='URL Arquivo Vídeo (Formatos MP4 / FLV / WebM)')),
('upload_pauta', models.FileField(blank=True, null=True, upload_to=sapl.comissoes.models.pauta_upload_path, validators=[sapl.utils.restringe_tipos_de_arquivo_txt], verbose_name='Pauta da Reunião')),
('upload_ata', models.FileField(blank=True, null=True, upload_to=sapl.comissoes.models.ata_upload_path, validators=[sapl.utils.restringe_tipos_de_arquivo_txt], verbose_name='Ata da Reunião')),
('upload_anexo', models.FileField(blank=True, null=True, upload_to=sapl.comissoes.models.anexo_upload_path, verbose_name='Anexo da Reunião')),
('comissao', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='comissoes.Comissao', verbose_name='Comissão')),
('periodo', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='comissoes.Periodo', verbose_name='Periodo da Composicão da Comissão')),
('tipo', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='comissoes.TipoComissao', verbose_name='Tipo')),
],
options={
'verbose_name': 'Reunião de Comissão',
'verbose_name_plural': 'Reuniões de Comissão',
},
),
]

16
sapl/comissoes/migrations/0005_merge.py

@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.13 on 2018-02-26 10:41
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('comissoes', '0004_auto_20180102_1652'),
('comissoes', '0003_reuniao'),
]
operations = [
]

25
sapl/comissoes/migrations/0006_auto_20180227_0842.py

@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.13 on 2018-02-27 11:42
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('comissoes', '0005_merge'),
]
operations = [
migrations.AlterField(
model_name='reuniao',
name='url_audio',
field=models.URLField(blank=True, max_length=150, null=True, verbose_name='URL Arquivo Áudio (Formatos MP3 / AAC)'),
),
migrations.AlterField(
model_name='reuniao',
name='url_video',
field=models.URLField(blank=True, max_length=150, null=True, verbose_name='URL Arquivo Vídeo (Formatos MP4 / FLV / WebM)'),
),
]

25
sapl/comissoes/migrations/0007_auto_20180227_1025.py

@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.13 on 2018-02-27 13:25
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('comissoes', '0006_auto_20180227_0842'),
]
operations = [
migrations.AlterField(
model_name='reuniao',
name='hora_fim',
field=models.CharField(max_length=5, verbose_name='Horário de Término (hh:mm)'),
),
migrations.AlterField(
model_name='reuniao',
name='hora_inicio',
field=models.CharField(max_length=5, verbose_name='Horário de Início (hh:mm)'),
),
]

25
sapl/comissoes/migrations/0008_auto_20180227_1111.py

@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.13 on 2018-02-27 14:11
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('comissoes', '0007_auto_20180227_1025'),
]
operations = [
migrations.AlterField(
model_name='reuniao',
name='url_audio',
field=models.URLField(blank=True, max_length=150, verbose_name='URL Arquivo Áudio (Formatos MP3 / AAC)'),
),
migrations.AlterField(
model_name='reuniao',
name='url_video',
field=models.URLField(blank=True, max_length=150, verbose_name='URL Arquivo Vídeo (Formatos MP4 / FLV / WebM)'),
),
]

41
sapl/comissoes/migrations/0009_auto_20180301_1011.py

@ -0,0 +1,41 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.13 on 2018-03-01 13:11
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('comissoes', '0008_auto_20180227_1111'),
]
operations = [
migrations.AlterField(
model_name='reuniao',
name='local_reuniao',
field=models.CharField(blank=True, max_length=100, verbose_name='Local da Reunião'),
),
migrations.AlterField(
model_name='reuniao',
name='observacao',
field=models.TextField(blank=True, max_length=150, verbose_name='Observação'),
),
migrations.AlterField(
model_name='reuniao',
name='tipo',
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='comissoes.TipoComissao', verbose_name='Tipo de Comissão'),
),
migrations.AlterField(
model_name='reuniao',
name='url_audio',
field=models.URLField(blank=True, max_length=150, verbose_name='URL do Arquivo de Áudio (Formatos MP3 / AAC)'),
),
migrations.AlterField(
model_name='reuniao',
name='url_video',
field=models.URLField(blank=True, max_length=150, verbose_name='URL do Arquivo de Vídeo (Formatos MP4 / FLV / WebM)'),
),
]

25
sapl/comissoes/migrations/0010_auto_20180306_0918.py

@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.13 on 2018-03-06 12:18
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('comissoes', '0009_auto_20180301_1011'),
]
operations = [
migrations.AlterField(
model_name='reuniao',
name='hora_fim',
field=models.TimeField(verbose_name='Horário de Término (hh:mm)'),
),
migrations.AlterField(
model_name='reuniao',
name='hora_inicio',
field=models.TimeField(verbose_name='Horário de Início (hh:mm)'),
),
]

133
sapl/comissoes/models.py

@ -1,11 +1,12 @@
import reversion
from django.db import models from django.db import models
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from model_utils import Choices from model_utils import Choices
import reversion
from sapl.base.models import Autor from sapl.base.models import Autor
from sapl.parlamentares.models import Parlamentar from sapl.parlamentares.models import Parlamentar
from sapl.utils import YES_NO_CHOICES, SaplGenericRelation from sapl.utils import (YES_NO_CHOICES, SaplGenericRelation,
restringe_tipos_de_arquivo_txt, texto_upload_path)
@reversion.register() @reversion.register()
@ -52,22 +53,18 @@ class Comissao(models.Model):
secretario = models.CharField( secretario = models.CharField(
max_length=30, blank=True, verbose_name=_('Secretário')) max_length=30, blank=True, verbose_name=_('Secretário'))
telefone_reuniao = models.CharField( telefone_reuniao = models.CharField(
max_length=15, max_length=15, blank=True,
blank=True,
verbose_name=_('Tel. Sala Reunião')) verbose_name=_('Tel. Sala Reunião'))
endereco_secretaria = models.CharField( endereco_secretaria = models.CharField(
max_length=100, max_length=100, blank=True,
blank=True,
verbose_name=_('Endereço Secretaria')) verbose_name=_('Endereço Secretaria'))
telefone_secretaria = models.CharField( telefone_secretaria = models.CharField(
max_length=15, max_length=15, blank=True,
blank=True,
verbose_name=_('Tel. Secretaria')) verbose_name=_('Tel. Secretaria'))
fax_secretaria = models.CharField( fax_secretaria = models.CharField(
max_length=15, blank=True, verbose_name=_('Fax Secretaria')) max_length=15, blank=True, verbose_name=_('Fax Secretaria'))
agenda_reuniao = models.CharField( agenda_reuniao = models.CharField(
max_length=100, max_length=100, blank=True,
blank=True,
verbose_name=_('Data/Hora Reunião')) verbose_name=_('Data/Hora Reunião'))
local_reuniao = models.CharField( local_reuniao = models.CharField(
max_length=100, blank=True, verbose_name=_('Local Reunião')) max_length=100, blank=True, verbose_name=_('Local Reunião'))
@ -83,7 +80,6 @@ class Comissao(models.Model):
default=False, default=False,
choices=YES_NO_CHOICES, choices=YES_NO_CHOICES,
verbose_name=_('Comissão Ativa?')) verbose_name=_('Comissão Ativa?'))
autor = SaplGenericRelation(Autor, autor = SaplGenericRelation(Autor,
related_query_name='comissao_set', related_query_name='comissao_set',
fields_search=( fields_search=(
@ -170,8 +166,7 @@ class Participacao(models.Model): # ComposicaoComissao
null=True, null=True,
verbose_name=_('Data Desligamento')) verbose_name=_('Data Desligamento'))
motivo_desligamento = models.CharField( motivo_desligamento = models.CharField(
max_length=150, max_length=150, blank=True,
blank=True,
verbose_name=_('Motivo Desligamento')) verbose_name=_('Motivo Desligamento'))
observacao = models.CharField( observacao = models.CharField(
max_length=150, blank=True, verbose_name=_('Observação')) max_length=150, blank=True, verbose_name=_('Observação'))
@ -182,3 +177,113 @@ class Participacao(models.Model): # ComposicaoComissao
def __str__(self): def __str__(self):
return '%s : %s' % (self.cargo, self.parlamentar) return '%s : %s' % (self.cargo, self.parlamentar)
def get_comissao_media_path(instance, subpath, filename):
return './sapl/comissao/%s/%s/%s' % (instance.numero, subpath, filename)
def pauta_upload_path(instance, filename):
return texto_upload_path(instance, filename, subpath='pauta', pk_first=True)
def ata_upload_path(instance, filename):
return texto_upload_path(instance, filename, subpath='ata', pk_first=True)
def anexo_upload_path(instance, filename):
return texto_upload_path(instance, filename, subpath='anexo', pk_first=True)
class Reuniao(models.Model):
periodo = models. ForeignKey(
Periodo,
on_delete=models.PROTECT,
verbose_name=_('Periodo da Composicão da Comissão'))
comissao = models.ForeignKey(
Comissao,
on_delete=models.PROTECT,
verbose_name=_('Comissão'))
tipo = models.ForeignKey(
TipoComissao,
on_delete=models.PROTECT,
verbose_name=_('Tipo de Comissão'))
numero = models.PositiveIntegerField(verbose_name=_('Número'))
nome = models.CharField(
max_length=100, verbose_name=_('Nome da Reunião'))
tema = models.CharField(
max_length=100, verbose_name=_('Tema da Reunião'))
data = models.DateField(verbose_name=_('Data'))
hora_inicio = models.TimeField(
verbose_name=_('Horário de Início (hh:mm)'))
hora_fim = models.TimeField(
verbose_name=_('Horário de Término (hh:mm)'))
local_reuniao = models.CharField(
max_length=100, blank=True, verbose_name=_('Local da Reunião'))
observacao = models.TextField(
max_length=150, blank=True, verbose_name=_('Observação'))
url_audio = models.URLField(
max_length=150, blank=True,
verbose_name=_('URL do Arquivo de Áudio (Formatos MP3 / AAC)'))
url_video = models.URLField(
max_length=150, blank=True,
verbose_name=_('URL do Arquivo de Vídeo (Formatos MP4 / FLV / WebM)'))
upload_pauta = models.FileField(
blank=True, null=True,
upload_to=pauta_upload_path,
verbose_name=_('Pauta da Reunião'),
validators=[restringe_tipos_de_arquivo_txt])
upload_ata = models.FileField(
blank=True, null=True,
upload_to=ata_upload_path,
verbose_name=_('Ata da Reunião'),
validators=[restringe_tipos_de_arquivo_txt])
upload_anexo = models.FileField(
blank=True, null=True,
upload_to=anexo_upload_path,
verbose_name=_('Anexo da Reunião'))
class Meta:
verbose_name = _('Reunião de Comissão')
verbose_name_plural = _('Reuniões de Comissão')
def __str__(self):
return self.nome
def delete(self, using=None, keep_parents=False):
if self.upload_pauta:
self.upload_pauta.delete()
if self.upload_ata:
self.upload_ata.delete()
if self.upload_anexo:
self.upload_anexo.delete()
return models.Model.delete(
self, using=using, keep_parents=keep_parents)
def save(self, force_insert=False, force_update=False, using=None,
update_fields=None):
if not self.pk and (self.upload_pauta or self.upload_ata or
self.upload_anexo):
upload_pauta = self.upload_pauta
upload_ata = self.upload_ata
upload_anexo = self.upload_anexo
self.upload_pauta = None
self.upload_ata = None
self.upload_anexo = None
models.Model.save(self, force_insert=force_insert,
force_update=force_update,
using=using,
update_fields=update_fields)
self.upload_pauta = upload_pauta
self.upload_ata = upload_ata
self.upload_anexo = upload_anexo
return models.Model.save(self, force_insert=force_insert,
force_update=force_update,
using=using,
update_fields=update_fields)

3
sapl/comissoes/urls.py

@ -1,7 +1,7 @@
from django.conf.urls import include, url from django.conf.urls import include, url
from sapl.comissoes.views import (CargoCrud, ComissaoCrud, ComposicaoCrud, from sapl.comissoes.views import (CargoCrud, ComissaoCrud, ComposicaoCrud,
MateriasTramitacaoListView, ParticipacaoCrud, MateriasTramitacaoListView, ParticipacaoCrud,
PeriodoComposicaoCrud, TipoComissaoCrud) PeriodoComposicaoCrud, ReuniaoCrud, TipoComissaoCrud)
from .apps import AppConfig from .apps import AppConfig
@ -10,6 +10,7 @@ app_name = AppConfig.name
urlpatterns = [ urlpatterns = [
url(r'^comissao/', include(ComissaoCrud.get_urls() + url(r'^comissao/', include(ComissaoCrud.get_urls() +
ComposicaoCrud.get_urls() + ComposicaoCrud.get_urls() +
ReuniaoCrud.get_urls() +
ParticipacaoCrud.get_urls())), ParticipacaoCrud.get_urls())),
url(r'^comissao/(?P<pk>\d+)/materias-em-tramitacao$', url(r'^comissao/(?P<pk>\d+)/materias-em-tramitacao$',

57
sapl/comissoes/views.py

@ -3,13 +3,23 @@ from django.core.urlresolvers import reverse
from django.db.models import F from django.db.models import F
from django.views.decorators.clickjacking import xframe_options_exempt from django.views.decorators.clickjacking import xframe_options_exempt
from django.views.generic import ListView from django.views.generic import ListView
from django.views.generic.base import RedirectView
from django.views.generic.detail import DetailView
from django.views.generic.edit import FormMixin
from sapl.base.models import AppConfig as AppsAppConfig
from sapl.crud.base import (RP_DETAIL, RP_LIST, Crud,
CrudAux, MasterDetailCrud,
PermissionRequiredForAppCrudMixin)
from sapl.comissoes.forms import ParticipacaoCreateForm, ParticipacaoEditForm from sapl.comissoes.forms import ParticipacaoCreateForm, ParticipacaoEditForm
from sapl.crud.base import RP_DETAIL, RP_LIST, Crud, CrudAux, MasterDetailCrud
from sapl.materia.models import MateriaLegislativa, Tramitacao from sapl.materia.models import MateriaLegislativa, Tramitacao
from .forms import ComissaoForm from .forms import ReuniaoForm, ComissaoForm
from .models import (CargoComissao, Comissao, Composicao, Participacao, from .models import (CargoComissao, Comissao, Composicao, Participacao,
Periodo, TipoComissao) Periodo, TipoComissao, Reuniao)
from sapl.comissoes.apps import AppConfig
def pegar_url_composicao(pk): def pegar_url_composicao(pk):
@ -136,3 +146,44 @@ class MateriasTramitacaoListView(ListView):
MateriasTramitacaoListView, self).get_context_data(**kwargs) MateriasTramitacaoListView, self).get_context_data(**kwargs)
context['object'] = Comissao.objects.get(id=self.kwargs['pk']) context['object'] = Comissao.objects.get(id=self.kwargs['pk'])
return context return context
class ReuniaoCrud(MasterDetailCrud):
model = Reuniao
parent_field = 'comissao'
public = [RP_LIST, RP_DETAIL, ]
class BaseMixin(MasterDetailCrud.BaseMixin):
list_field_names = ['nome', 'tema', 'comissao']
@property
def list_url(self):
return ''
class ListView(MasterDetailCrud.ListView):
paginate_by = 10
class UpdateView(MasterDetailCrud.UpdateView):
form_class = ReuniaoForm
def get_initial(self):
return {'comissao': self.object.comissao}
class CreateView(MasterDetailCrud.CreateView):
form_class = ReuniaoForm
def get_initial(self):
comissao = Comissao.objects.get(id=self.kwargs['pk'])
return {'comissao': comissao}
class DeleteView(MasterDetailCrud.DeleteView):
pass
class DetailView(MasterDetailCrud.DetailView):
@xframe_options_exempt
def get(self, request, *args, **kwargs):
return super().get(request, *args, **kwargs)

2
sapl/crispy_layout_mixin.py

@ -96,7 +96,7 @@ def get_field_display(obj, fieldname):
if value is None: if value is None:
display = '' display = ''
elif 'date' in str_type_from_value: elif '.date' in str_type_from_value:
display = formats.date_format(value, "SHORT_DATE_FORMAT") display = formats.date_format(value, "SHORT_DATE_FORMAT")
elif 'bool' in str_type_from_value: elif 'bool' in str_type_from_value:
display = _('Sim') if value else _('Não') display = _('Sim') if value else _('Não')

1
sapl/materia/forms.py

@ -1263,7 +1263,6 @@ class ProposicaoForm(forms.ModelForm):
not cd['texto_original'] and \ not cd['texto_original'] and \
inst.texto_original: inst.texto_original:
inst.texto_original.delete() inst.texto_original.delete()
self.gerar_hash(inst, receber_recibo) self.gerar_hash(inst, receber_recibo)
return super().save(commit) return super().save(commit)

49
sapl/redireciona_urls/views.py

@ -31,6 +31,7 @@ parlamentar_mesa_diretora = (app_parlamentares + ':mesa_diretora')
comissao_list = (app_comissoes + ':comissao_list') comissao_list = (app_comissoes + ':comissao_list')
comissao_detail = (app_comissoes + ':comissao_detail') comissao_detail = (app_comissoes + ':comissao_detail')
reuniao_detail = (app_comissoes + ':reuniao_detail')
materialegislativa_detail = (app_materia + ':materialegislativa_detail') materialegislativa_detail = (app_materia + ':materialegislativa_detail')
materialegislativa_list = (app_materia + ':pesquisar_materia') materialegislativa_list = (app_materia + ':pesquisar_materia')
@ -633,3 +634,51 @@ class RedirecionaMateriasPorAnoAutorTipo(RedirectView):
url = has_iframe(url, self.request) url = has_iframe(url, self.request)
return url return url
class RedirecionaReuniao(RedirectView):
permanent = True
def get_redirect_url(self):
pk_reuniao = self.request.GET.get(
'cod_comissao',
EMPTY_STRING)
url = EMPTY_STRING
if pk_reuniao:
kwargs = {'pk': pk_reuniao}
try:
url = reverse(reuniao_detail, kwargs=kwargs)
except NoReverseMatch:
raise UnknownUrlNameError(reuniao_detail)
else:
try:
url = reverse(reuniao_list)
except NoReverseMatch:
raise UnknownUrlNameError(reuniao_list)
year = self.request.GET.get(
'ano_reuniao',
EMPTY_STRING)
month = self.request.GET.get(
'mes_reuniao',
EMPTY_STRING)
day = self.request.GET.get(
'dia_reuniao',
EMPTY_STRING)
tipo_reuniao = self.request.GET.get(
'tip_reuniao',
EMPTY_STRING)
# Remove zeros à esquerda
day = day.lstrip("0")
month = month.lstrip("0")
args = EMPTY_STRING
args += "?data_inicio__year=%s" % (year)
args += "&data_inicio__month=%s" % (month)
args += "&data_inicio__day=%s" % (day)
args += "&tipo=%s&salvar=Pesquisar" % (tipo_reuniao)
url = "%s%s" % (url, args)
url = has_iframe(url, self.request)
return url

1
sapl/rules/map_rules.py

@ -89,6 +89,7 @@ rules_group_comissoes = {
(comissoes.Composicao, __base__), (comissoes.Composicao, __base__),
(comissoes.Participacao, __base__), (comissoes.Participacao, __base__),
(materia.Relatoria, __base__), (materia.Relatoria, __base__),
(comissoes.Reuniao, __base__),
] ]
} }

15
sapl/templates/comissoes/layouts.yaml

@ -1,4 +1,4 @@
{% load i18n %} {% load i18n %}
CargoComissao: CargoComissao:
{% trans 'Período de composição de Comissão' %}: {% trans 'Período de composição de Comissão' %}:
- nome:10 unico - nome:10 unico
@ -42,4 +42,15 @@ ParticipacaoEdit:
- nome_parlamentar cargo titular - nome_parlamentar cargo titular
- data_designacao data_desligamento - data_designacao data_desligamento
- motivo_desligamento - motivo_desligamento
- observacao - observacao
Reuniao:
{% trans 'Reunião' %}:
- periodo numero tipo
- nome tema local_reuniao
- data hora_inicio hora_fim
- url_video url_audio
- observacao
- upload_pauta upload_ata upload_anexo
- comissao

8
sapl/templates/comissoes/reunioes.html

@ -1,8 +0,0 @@
{% extends "comissoes/comissao_detail.html" %}
{% load i18n %}
{% block actions %}{% endblock actions %}
{% block detail_content %}
TODO ... Reuniões
{% endblock detail_content %}

2
sapl/templates/comissoes/subnav.yaml

@ -6,3 +6,5 @@
urls_extras: participacao_detail participacao_create participacao_edit participacao_delete urls_extras: participacao_detail participacao_create participacao_edit participacao_delete
- title: {% trans 'Matérias em Tramitação' %} - title: {% trans 'Matérias em Tramitação' %}
url: materias_em_tramitacao url: materias_em_tramitacao
- title: {% trans 'Reunião' %}
url: reuniao_list

Loading…
Cancel
Save