diff --git a/sapl/protocoloadm/forms.py b/sapl/protocoloadm/forms.py index 63474be8e..90fb7c7ce 100644 --- a/sapl/protocoloadm/forms.py +++ b/sapl/protocoloadm/forms.py @@ -29,12 +29,11 @@ from .models import (AcompanhamentoDocumento, DocumentoAcessorioAdministrativo, TIPOS_PROTOCOLO = [('0', 'Recebido'), ('1', 'Enviado'), - ('2', 'Interno'), ('', '---------')] + ('2', 'Interno')] TIPOS_PROTOCOLO_CREATE = [ ('0', 'Recebido'), ('1', 'Enviado'), ('2', 'Interno')] -NATUREZA_PROCESSO = [('', '---------'), - ('0', 'Administrativo'), +NATUREZA_PROCESSO = [('0', 'Administrativo'), ('1', 'Legislativo')] @@ -68,13 +67,18 @@ class AcompanhamentoDocumentoForm(ModelForm): class ProtocoloFilterSet(django_filters.FilterSet): - ano = django_filters.ChoiceFilter(required=False, - label='Ano', - choices=choice_anos_com_protocolo) + ano = django_filters.ChoiceFilter( + required=False, + label='Ano', + choices=choice_anos_com_protocolo) - assunto_ementa = django_filters.CharFilter(lookup_expr='icontains') + assunto_ementa = django_filters.CharFilter( + label=_('Assunto'), + lookup_expr='icontains') - interessado = django_filters.CharFilter(lookup_expr='icontains') + interessado = django_filters.CharFilter( + label=_('Interessado'), + lookup_expr='icontains') autor = django_filters.CharFilter(widget=forms.HiddenInput()) @@ -91,7 +95,7 @@ class ProtocoloFilterSet(django_filters.FilterSet): widget=forms.Select( attrs={'class': 'selector'})) - o = AnoNumeroOrderingFilter() + o = AnoNumeroOrderingFilter(help_text='') class Meta: filter_overrides = {models.DateTimeField: { @@ -110,9 +114,6 @@ class ProtocoloFilterSet(django_filters.FilterSet): def __init__(self, *args, **kwargs): super(ProtocoloFilterSet, self).__init__(*args, **kwargs) - self.filters['autor'].label = 'Tipo de Matéria' - self.filters['assunto_ementa'].label = 'Assunto' - row1 = to_row( [('numero', 4), ('ano', 4), @@ -136,9 +137,7 @@ class ProtocoloFilterSet(django_filters.FilterSet): 'Limpar Autor', css_class='btn btn-primary btn-sm'), 10)]) row5 = to_row( - [('tipo_processo', 12)]) - row6 = to_row( - [('o', 12)]) + [('tipo_processo', 6), ('o', 6)]) self.form.helper = FormHelper() self.form.helper.form_method = 'GET' @@ -146,9 +145,10 @@ class ProtocoloFilterSet(django_filters.FilterSet): Fieldset(_('Pesquisar Protocolo'), row1, row2, row3, + row5, HTML(autor_label), HTML(autor_modal), - row4, row5, row6, + row4, form_actions(label='Pesquisar')) ) diff --git a/sapl/protocoloadm/migrations/0013_auto_20190106_1336.py b/sapl/protocoloadm/migrations/0013_auto_20190106_1336.py new file mode 100644 index 000000000..3cd58e085 --- /dev/null +++ b/sapl/protocoloadm/migrations/0013_auto_20190106_1336.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.8 on 2019-01-06 15:36 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('protocoloadm', '0012_auto_20190104_1021'), + ] + + operations = [ + migrations.AlterField( + model_name='protocolo', + name='tipo_documento', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='protocoloadm.TipoDocumentoAdministrativo', verbose_name='Tipo de Documento'), + ), + migrations.AlterField( + model_name='protocolo', + name='tipo_materia', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='materia.TipoMateriaLegislativa', verbose_name='Tipo de Matéria'), + ), + ] diff --git a/sapl/protocoloadm/models.py b/sapl/protocoloadm/models.py index 1b061fa18..438037205 100644 --- a/sapl/protocoloadm/models.py +++ b/sapl/protocoloadm/models.py @@ -1,8 +1,8 @@ -import reversion from django.db import models from django.utils import timezone from django.utils.translation import ugettext_lazy as _ from model_utils import Choices +import reversion from sapl.base.models import Autor from sapl.materia.models import TipoMateriaLegislativa, UnidadeTramitacao @@ -78,13 +78,13 @@ class Protocolo(models.Model): blank=True, null=True, on_delete=models.PROTECT, - verbose_name=_('Tipo de documento')) + verbose_name=_('Tipo de Documento')) tipo_materia = models.ForeignKey( TipoMateriaLegislativa, blank=True, null=True, on_delete=models.PROTECT, - verbose_name=_('Tipo Matéria')) + verbose_name=_('Tipo de Matéria')) numero_paginas = models.PositiveIntegerField( blank=True, null=True, verbose_name=_('Número de Páginas')) observacao = models.TextField( @@ -299,10 +299,12 @@ class TramitacaoAdministrativo(models.Model): 'documento': self.documento, 'status': self.status } + @reversion.register() class AcompanhamentoDocumento(models.Model): usuario = models.CharField(max_length=50) - documento = models.ForeignKey(DocumentoAdministrativo, on_delete=models.CASCADE) + documento = models.ForeignKey( + DocumentoAdministrativo, on_delete=models.CASCADE) email = models.EmailField( max_length=100, verbose_name=_('E-mail')) data_cadastro = models.DateField(auto_now_add=True)