From 35dfe2fafa85a755cf95d50e08135327181d5534 Mon Sep 17 00:00:00 2001 From: Eduardo Edson Batista Cordeiro Alves Date: Thu, 3 Nov 2016 17:26:20 -0200 Subject: [PATCH] =?UTF-8?q?Remove=20campo=20n=C3=A3o=20usado=20em=20protoc?= =?UTF-8?q?olar=20mat=C3=A9ria?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../migrations/0019_auto_20161028_0232.py | 19 --------- .../migrations/0020_auto_20161028_1335.py | 39 ------------------- .../migrations/0021_auto_20161028_1335.py | 24 ------------ sapl/protocoloadm/forms.py | 23 ++++------- .../migrations/0006_auto_20161103_1721.py | 20 ++++++++++ sapl/protocoloadm/models.py | 2 +- sapl/protocoloadm/views.py | 1 - 7 files changed, 28 insertions(+), 100 deletions(-) delete mode 100644 sapl/norma/migrations/0019_auto_20161028_0232.py delete mode 100644 sapl/norma/migrations/0020_auto_20161028_1335.py delete mode 100644 sapl/norma/migrations/0021_auto_20161028_1335.py create mode 100644 sapl/protocoloadm/migrations/0006_auto_20161103_1721.py diff --git a/sapl/norma/migrations/0019_auto_20161028_0232.py b/sapl/norma/migrations/0019_auto_20161028_0232.py deleted file mode 100644 index 075607017..000000000 --- a/sapl/norma/migrations/0019_auto_20161028_0232.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-10-28 02:32 -from __future__ import unicode_literals - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('norma', '0018_auto_20161027_1434'), - ] - - operations = [ - migrations.AlterUniqueTogether( - name='assuntonormarelationship', - unique_together=set([('assunto', 'norma')]), - ), - ] diff --git a/sapl/norma/migrations/0020_auto_20161028_1335.py b/sapl/norma/migrations/0020_auto_20161028_1335.py deleted file mode 100644 index 4391c8340..000000000 --- a/sapl/norma/migrations/0020_auto_20161028_1335.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-10-28 13:35 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('norma', '0019_auto_20161028_0232'), - ] - - operations = [ - migrations.AlterUniqueTogether( - name='assuntonormarelationship', - unique_together=set([]), - ), - migrations.RemoveField( - model_name='assuntonormarelationship', - name='assunto', - ), - migrations.RemoveField( - model_name='assuntonormarelationship', - name='norma', - ), - migrations.RemoveField( - model_name='normajuridica', - name='assuntos', - ), - migrations.AddField( - model_name='normajuridica', - name='assuntos', - field=models.TextField(blank=True, null=True), - ), - migrations.DeleteModel( - name='AssuntoNormaRelationship', - ), - ] diff --git a/sapl/norma/migrations/0021_auto_20161028_1335.py b/sapl/norma/migrations/0021_auto_20161028_1335.py deleted file mode 100644 index bbadc60d2..000000000 --- a/sapl/norma/migrations/0021_auto_20161028_1335.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.9.7 on 2016-10-28 13:35 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('norma', '0020_auto_20161028_1335'), - ] - - operations = [ - migrations.RemoveField( - model_name='normajuridica', - name='assuntos', - ), - migrations.AddField( - model_name='normajuridica', - name='assuntos', - field=models.ManyToManyField(blank=True, to='norma.AssuntoNorma', verbose_name='Assuntos'), - ), - ] diff --git a/sapl/protocoloadm/forms.py b/sapl/protocoloadm/forms.py index a75c4072b..3e8a44ec5 100644 --- a/sapl/protocoloadm/forms.py +++ b/sapl/protocoloadm/forms.py @@ -21,6 +21,7 @@ from .models import (DocumentoAcessorioAdministrativo, DocumentoAdministrativo, TramitacaoAdministrativo) TIPOS_PROTOCOLO = [('0', 'Enviado'), ('1', 'Recebido'), ('', 'Ambos')] +TIPOS_PROTOCOLO_CREATE = [('0', 'Enviado'), ('1', 'Recebido')] NATUREZA_PROCESSO = [('', 'Ambos'), ('0', 'Administrativo'), @@ -270,7 +271,7 @@ class ProtocoloDocumentForm(ModelForm): tipo_protocolo = forms.ChoiceField(required=True, label=_('Tipo de Protocolo'), - choices=TIPOS_PROTOCOLO,) + choices=TIPOS_PROTOCOLO_CREATE,) tipo_documento = forms.ModelChoiceField( label=_('Tipo de Documento'), @@ -330,11 +331,6 @@ class ProtocoloDocumentForm(ModelForm): class ProtocoloMateriaForm(ModelForm): - - tipo_protocolo = forms.ChoiceField(required=True, - label='Tipo de Protocolo', - choices=TIPOS_PROTOCOLO,) - autor = forms.IntegerField(widget=forms.HiddenInput(), required=False) def clean_autor(self): @@ -349,8 +345,7 @@ class ProtocoloMateriaForm(ModelForm): class Meta: model = Protocolo - fields = ['tipo_protocolo', - 'tipo_materia', + fields = ['tipo_materia', 'numero_paginas', 'autor', 'observacao'] @@ -358,11 +353,9 @@ class ProtocoloMateriaForm(ModelForm): def __init__(self, *args, **kwargs): row1 = to_row( - [(InlineRadios('tipo_protocolo'), 12)]) - row2 = to_row( [('tipo_materia', 4), ('numero_paginas', 4)]) - row3 = to_row( + row2 = to_row( [('autor', 0), (Button('pesquisar', 'Pesquisar Autor', @@ -370,25 +363,23 @@ class ProtocoloMateriaForm(ModelForm): (Button('limpar', 'limpar Autor', css_class='btn btn-primary btn-sm'), 10)]) - row4 = to_row( + row3 = to_row( [('observacao', 12)]) self.helper = FormHelper() self.helper.layout = Layout( Fieldset(_('Identificação da Matéria'), row1, + HTML(autor_label), + HTML(autor_modal), row2, - HTML(autor_label), - HTML(autor_modal), row3, - row4, form_actions(save_label='Protocolar Matéria') ) ) super(ProtocoloMateriaForm, self).__init__( *args, **kwargs) - self.fields['tipo_protocolo'].inline_class = True class DocumentoAcessorioAdministrativoForm(ModelForm): diff --git a/sapl/protocoloadm/migrations/0006_auto_20161103_1721.py b/sapl/protocoloadm/migrations/0006_auto_20161103_1721.py new file mode 100644 index 000000000..4100f4157 --- /dev/null +++ b/sapl/protocoloadm/migrations/0006_auto_20161103_1721.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.7 on 2016-11-03 17:21 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('protocoloadm', '0005_auto_20161027_1741'), + ] + + operations = [ + migrations.AlterField( + model_name='protocolo', + name='tipo_protocolo', + field=models.PositiveIntegerField(blank=True, null=True, verbose_name='Tipo de Protocolo'), + ), + ] diff --git a/sapl/protocoloadm/models.py b/sapl/protocoloadm/models.py index 972fe53c4..68401a7d8 100644 --- a/sapl/protocoloadm/models.py +++ b/sapl/protocoloadm/models.py @@ -119,7 +119,7 @@ class Protocolo(models.Model): # TODO transformar campo timestamp em auto_now_add timestamp = models.DateTimeField() tipo_protocolo = models.PositiveIntegerField( - verbose_name=_('Tipo de Protocolo')) + blank=True, null=True, verbose_name=_('Tipo de Protocolo')) tipo_processo = models.PositiveIntegerField() interessado = models.CharField( max_length=60, blank=True, verbose_name=_('Interessado')) diff --git a/sapl/protocoloadm/views.py b/sapl/protocoloadm/views.py index 447f96a9f..e45c943b4 100644 --- a/sapl/protocoloadm/views.py +++ b/sapl/protocoloadm/views.py @@ -361,7 +361,6 @@ class ProtocoloMateriaView(PermissionRequiredMixin, CreateView): protocolo.data = datetime.now().strftime("%Y-%m-%d") protocolo.hora = datetime.now().strftime("%H:%M") protocolo.timestamp = datetime.now().strftime("%Y-%m-%d %H:%M") - protocolo.tipo_protocolo = self.request.POST['tipo_protocolo'] protocolo.tipo_processo = '0' # TODO validar o significado if form.cleaned_data['autor']: protocolo.autor = form.cleaned_data['autor']