diff --git a/sapl/materia/forms.py b/sapl/materia/forms.py index 883b0946e..84a60dcb6 100644 --- a/sapl/materia/forms.py +++ b/sapl/materia/forms.py @@ -589,6 +589,8 @@ def filtra_tramitacao_destino_and_status(status, destino): class DespachoInicialForm(ModelForm): + comissao = forms.ModelChoiceField( + queryset=Comissao.objects.filter(ativa=True)) class Meta: model = DespachoInicial diff --git a/sapl/materia/models.py b/sapl/materia/models.py index fe7fc6331..f991e58df 100644 --- a/sapl/materia/models.py +++ b/sapl/materia/models.py @@ -295,6 +295,8 @@ class AssuntoMateria(models.Model): class DespachoInicial(models.Model): # TODO M2M? + # TODO Despachos não são necessáriamente comissoes, podem ser outros + # órgãos, ex: procuradorias materia = models.ForeignKey(MateriaLegislativa) comissao = models.ForeignKey(Comissao) diff --git a/sapl/materia/views.py b/sapl/materia/views.py index 22dc20bee..e177c9301 100644 --- a/sapl/materia/views.py +++ b/sapl/materia/views.py @@ -43,6 +43,7 @@ from sapl.utils import (TURNO_TRAMITACAO_CHOICES, YES_NO_CHOICES, autor_label, montar_row_autor) from .forms import (AcessorioEmLoteFilterSet, AcompanhamentoMateriaForm, + DespachoInicialForm, DocumentoAcessorioForm, MateriaLegislativaFilterSet, MateriaSimplificadaForm, PrimeiraTramitacaoEmLoteFilterSet, ReceberProposicaoForm, TramitacaoEmLoteFilterSet, @@ -881,6 +882,12 @@ class DespachoInicialCrud(MasterDetailCrud): help_path = '' public = [RP_LIST, RP_DETAIL] + class CreateView(MasterDetailCrud.CreateView): + form_class = DespachoInicialForm + + class UpdateView(MasterDetailCrud.UpdateView): + form_class = DespachoInicialForm + class LegislacaoCitadaCrud(MasterDetailCrud): model = LegislacaoCitada