Browse Source

Adapta todo o branch 474 original ao novo Master

pull/506/head
Eduardo Calil 9 years ago
parent
commit
8bdb2bbf98
  1. 3
      sapl/base/templatetags/common_tags.py
  2. 6
      sapl/parlamentares/forms.py
  3. 22
      sapl/parlamentares/migrations/0022_auto_20160624_1124.py
  4. 97
      sapl/protocoloadm/forms.py
  5. 114
      sapl/protocoloadm/migrations/0001_initial.py
  6. 59
      sapl/protocoloadm/migrations/0002_auto_20150729_1717.py
  7. 22
      sapl/protocoloadm/migrations/0003_documentoacessorioadministrativo_texto_integral.py
  8. 27
      sapl/protocoloadm/migrations/0004_auto_20151007_1035.py
  9. 22
      sapl/protocoloadm/migrations/0005_auto_20151008_0744.py
  10. 74
      sapl/protocoloadm/migrations/0006_auto_20160216_1015.py
  11. 19
      sapl/protocoloadm/migrations/0007_auto_20160218_1429.py
  12. 20
      sapl/protocoloadm/migrations/0008_auto_20160308_1436.py
  13. 20
      sapl/protocoloadm/migrations/0009_auto_20160309_1323.py
  14. 25
      sapl/protocoloadm/migrations/0010_auto_20160309_1407.py
  15. 20
      sapl/protocoloadm/migrations/0011_auto_20160318_1504.py
  16. 26
      sapl/protocoloadm/migrations/0012_auto_20160503_0926.py
  17. 26
      sapl/protocoloadm/migrations/0012_tipoinstituicao.py
  18. 16
      sapl/protocoloadm/migrations/0013_merge.py
  19. 7
      sapl/protocoloadm/models.py
  20. 20
      sapl/protocoloadm/urls.py
  21. 142
      sapl/protocoloadm/views.py
  22. 12
      sapl/templates/base.html
  23. 4
      sapl/templates/materia/materialegislativa_filter.html
  24. 9
      sapl/templates/protocoloadm/documentoadministrativo_detail.html
  25. 30
      sapl/templates/protocoloadm/documentoadministrativo_filter.html
  26. 8
      sapl/templates/protocoloadm/protocolo_filter.html
  27. 9
      sapl/templates/protocoloadm/protocolo_pesquisa.html
  28. 8
      sapl/templates/protocoloadm/protocoloadm_detail.html
  29. 40
      sapl/templates/protocoloadm/tramitacao.html
  30. 15
      sapl/templates/protocoloadm/tramitacao_edit.html
  31. 14
      sapl/templates/protocoloadm/tramitacao_incluir.html
  32. 9
      sapl/templates/protocoloadm/tramitacaoadministrativo_detail.html

3
sapl/base/templatetags/common_tags.py

@ -77,6 +77,3 @@ def get_delete_perm(value, arg):
can_delete = '.delete_' + nome_model can_delete = '.delete_' + nome_model
return perm.__contains__(nome_app + can_delete) return perm.__contains__(nome_app + can_delete)
# view.__class__.model._meta.app_label -> nome do app
# context.getcontext.get('view').__class__.model.__name__.lower() -> nome do model

6
sapl/parlamentares/forms.py

@ -30,9 +30,9 @@ class LegislaturaForm(ModelForm):
data_eleicao = cleaned_data['data_eleicao'] data_eleicao = cleaned_data['data_eleicao']
if data_inicio >= data_fim or data_eleicao >= data_inicio: if data_inicio >= data_fim or data_eleicao >= data_inicio:
raise ValidationError(_('A data início deve ser menor que a data \ raise ValidationError(_('A data início deve ser menor que a ' +
fim, e a data eleição deve ser menor que\ 'data fim, e a data eleição deve ser ' +
a data início')) 'menor que a data início'))
return cleaned_data return cleaned_data

22
sapl/parlamentares/migrations/0022_auto_20160624_1124.py

@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-06-24 14:24
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import sapl.parlamentares.models
class Migration(migrations.Migration):
dependencies = [
('parlamentares', '0021_merge'),
]
operations = [
migrations.AlterField(
model_name='sessaolegislativa',
name='legislatura',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='parlamentares.Legislatura', verbose_name=sapl.parlamentares.models.Legislatura),
),
]

97
sapl/protocoloadm/forms.py

@ -1,16 +1,18 @@
from datetime import datetime
import django_filters import django_filters
from crispy_forms.bootstrap import InlineRadios from crispy_forms.bootstrap import InlineRadios
from crispy_forms.helper import FormHelper from crispy_forms.helper import FormHelper
from crispy_forms.layout import HTML, Button, Field, Fieldset, Layout, Submit from crispy_forms.layout import HTML, Button, Fieldset, Layout, Submit
from django import forms from django import forms
from django.core.exceptions import ObjectDoesNotExist from django.core.exceptions import ObjectDoesNotExist, ValidationError
from django.db import models from django.db import models
from django.forms import ModelForm from django.forms import ModelForm
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from sapl.crispy_layout_mixin import form_actions, to_row from sapl.crispy_layout_mixin import form_actions, to_row
from sapl.materia.forms import RangeWidgetOverride from sapl.materia.forms import RangeWidgetOverride
from sapl.materia.models import Autor from sapl.materia.models import Autor, UnidadeTramitacao
from sapl.utils import RANGE_ANOS, autor_label, autor_modal from sapl.utils import RANGE_ANOS, autor_label, autor_modal
from .models import (DocumentoAcessorioAdministrativo, DocumentoAdministrativo, from .models import (DocumentoAcessorioAdministrativo, DocumentoAdministrativo,
@ -523,7 +525,6 @@ class TramitacaoAdmForm(ModelForm):
'data_encaminhamento', 'data_encaminhamento',
'data_fim_prazo', 'data_fim_prazo',
'texto', 'texto',
'documento',
] ]
widgets = { widgets = {
@ -532,22 +533,78 @@ class TramitacaoAdmForm(ModelForm):
'data_fim_prazo': forms.DateInput(format='%d/%m/%Y'), 'data_fim_prazo': forms.DateInput(format='%d/%m/%Y'),
} }
def __init__(self, *args, **kwargs): def clean(self):
self.helper = FormHelper() data_enc_form = self.cleaned_data['data_encaminhamento']
self.helper.layout = Layout( data_prazo_form = self.cleaned_data['data_fim_prazo']
Fieldset(_('Incluir Tramitação'), data_tram_form = self.cleaned_data['data_tramitacao']
'data_tramitacao',
'unidade_tramitacao_local', if self.errors:
'status', return self.errors
'unidade_tramitacao_destino',
'data_encaminhamento', ultima_tramitacao = TramitacaoAdministrativo.objects.filter(
'data_fim_prazo', documento_id=self.instance.documento_id).exclude(
'texto'), id=self.instance.id).last()
Field('documento', type="hidden"),
form_actions() if not self.instance.data_tramitacao:
)
super(TramitacaoAdmForm, self).__init__( if ultima_tramitacao:
*args, **kwargs) destino = ultima_tramitacao.unidade_tramitacao_destino
if (destino != self.cleaned_data['unidade_tramitacao_local']):
msg = _('A origem da nova tramitação deve ser igual ao '
'destino da última adicionada!')
raise ValidationError(msg)
if self.cleaned_data['data_tramitacao'] > datetime.now().date():
msg = _(
'A data de tramitação deve ser ' +
'menor ou igual a data de hoje!')
raise ValidationError(msg)
if (ultima_tramitacao and
data_tram_form < ultima_tramitacao.data_tramitacao):
msg = _('A data da nova tramitação deve ser ' +
'maior que a data da última tramitação!')
raise ValidationError(msg)
if data_enc_form < data_tram_form or data_prazo_form < data_tram_form:
msg = _('A data fim de prazo e encaminhamento devem ser ' +
'maiores que a data de tramitação!')
raise ValidationError(msg)
return self.cleaned_data
class TramitacaoAdmEditForm(TramitacaoAdmForm):
unidade_tramitacao_local = forms.ModelChoiceField(
queryset=UnidadeTramitacao.objects.all(),
widget=forms.HiddenInput())
data_tramitacao = forms.DateField(widget=forms.HiddenInput())
class Meta:
model = TramitacaoAdministrativo
fields = ['data_tramitacao',
'unidade_tramitacao_local',
'status',
'unidade_tramitacao_destino',
'data_encaminhamento',
'data_fim_prazo',
'texto',
]
widgets = {
'data_encaminhamento': forms.DateInput(format='%d/%m/%Y'),
'data_fim_prazo': forms.DateInput(format='%d/%m/%Y'),
}
def clean(self):
local = self.instance.unidade_tramitacao_local
data_tram = self.instance.data_tramitacao
self.cleaned_data['data_tramitacao'] = data_tram
self.cleaned_data['unidade_tramitacao_local'] = local
return super(TramitacaoAdmEditForm, self).clean()
class DocumentoAdministrativoForm(ModelForm): class DocumentoAdministrativoForm(ModelForm):

114
sapl/protocoloadm/migrations/0001_initial.py

@ -1,147 +1,163 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-06-24 14:31
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import migrations, models from django.db import migrations, models
import django.db.models.deletion
import sapl.protocoloadm.models
class Migration(migrations.Migration): class Migration(migrations.Migration):
initial = True
dependencies = [ dependencies = [
('materia', '0001_initial'), ('materia', '0038_auto_20160612_1506'),
] ]
operations = [ operations = [
migrations.CreateModel( migrations.CreateModel(
name='DocumentoAcessorioAdministrativo', name='DocumentoAcessorioAdministrativo',
fields=[ fields=[
('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('nome', models.CharField(max_length=30, verbose_name='Nome')), ('nome', models.CharField(max_length=30, verbose_name='Nome')),
('arquivo', models.CharField(max_length=100, verbose_name='Arquivo')), ('arquivo', models.FileField(blank=True, null=True, upload_to=sapl.protocoloadm.models.texto_upload_path, verbose_name='Arquivo')),
('data', models.DateField(blank=True, null=True, verbose_name='Data')), ('data', models.DateField(blank=True, null=True, verbose_name='Data')),
('autor', models.CharField(blank=True, max_length=50, null=True, verbose_name='Autor')), ('autor', models.CharField(blank=True, max_length=50, verbose_name='Autor')),
('assunto', models.TextField(blank=True, null=True, verbose_name='Assunto')), ('assunto', models.TextField(blank=True, verbose_name='Assunto')),
('indexacao', models.TextField(blank=True, null=True)), ('indexacao', models.TextField(blank=True)),
], ],
options={ options={
'verbose_name_plural': 'Documentos Acessórios',
'verbose_name': 'Documento Acessório', 'verbose_name': 'Documento Acessório',
'verbose_name_plural': 'Documentos Acessórios',
}, },
), ),
migrations.CreateModel( migrations.CreateModel(
name='DocumentoAdministrativo', name='DocumentoAdministrativo',
fields=[ fields=[
('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('numero', models.IntegerField(verbose_name='Número')), ('numero', models.PositiveIntegerField(verbose_name='Número')),
('ano', models.SmallIntegerField(verbose_name='Ano')), ('ano', models.PositiveSmallIntegerField(choices=[(2016, 2016), (2015, 2015), (2014, 2014), (2013, 2013), (2012, 2012), (2011, 2011), (2010, 2010), (2009, 2009), (2008, 2008), (2007, 2007), (2006, 2006), (2005, 2005), (2004, 2004), (2003, 2003), (2002, 2002), (2001, 2001), (2000, 2000), (1999, 1999), (1998, 1998), (1997, 1997), (1996, 1996), (1995, 1995), (1994, 1994), (1993, 1993), (1992, 1992), (1991, 1991), (1990, 1990), (1989, 1989), (1988, 1988), (1987, 1987), (1986, 1986), (1985, 1985), (1984, 1984), (1983, 1983), (1982, 1982), (1981, 1981), (1980, 1980), (1979, 1979), (1978, 1978), (1977, 1977), (1976, 1976), (1975, 1975), (1974, 1974), (1973, 1973), (1972, 1972), (1971, 1971), (1970, 1970), (1969, 1969), (1968, 1968), (1967, 1967), (1966, 1966), (1965, 1965), (1964, 1964), (1963, 1963), (1962, 1962), (1961, 1961), (1960, 1960), (1959, 1959), (1958, 1958), (1957, 1957), (1956, 1956), (1955, 1955), (1954, 1954), (1953, 1953), (1952, 1952), (1951, 1951), (1950, 1950), (1949, 1949), (1948, 1948), (1947, 1947), (1946, 1946), (1945, 1945), (1944, 1944), (1943, 1943), (1942, 1942), (1941, 1941), (1940, 1940), (1939, 1939), (1938, 1938), (1937, 1937), (1936, 1936), (1935, 1935), (1934, 1934), (1933, 1933), (1932, 1932), (1931, 1931), (1930, 1930), (1929, 1929), (1928, 1928), (1927, 1927), (1926, 1926), (1925, 1925), (1924, 1924), (1923, 1923), (1922, 1922), (1921, 1921), (1920, 1920), (1919, 1919), (1918, 1918), (1917, 1917), (1916, 1916), (1915, 1915), (1914, 1914), (1913, 1913), (1912, 1912), (1911, 1911), (1910, 1910), (1909, 1909), (1908, 1908), (1907, 1907), (1906, 1906), (1905, 1905), (1904, 1904), (1903, 1903), (1902, 1902), (1901, 1901), (1900, 1900), (1899, 1899), (1898, 1898), (1897, 1897), (1896, 1896), (1895, 1895), (1894, 1894), (1893, 1893), (1892, 1892), (1891, 1891), (1890, 1890)], verbose_name='Ano')),
('data', models.DateField(verbose_name='Data')), ('data', models.DateField(verbose_name='Data')),
('numero_protocolo', models.IntegerField(blank=True, null=True, verbose_name='Núm. Protocolo')), ('numero_protocolo', models.PositiveIntegerField(blank=True, null=True, verbose_name='Núm. Protocolo')),
('interessado', models.CharField(blank=True, max_length=50, null=True, verbose_name='Interessado')), ('interessado', models.CharField(blank=True, max_length=50, verbose_name='Interessado')),
('dias_prazo', models.IntegerField(blank=True, null=True, verbose_name='Dias Prazo')), ('dias_prazo', models.PositiveIntegerField(blank=True, null=True, verbose_name='Dias Prazo')),
('data_fim_prazo', models.DateField(blank=True, null=True, verbose_name='Data Fim Prazo')), ('data_fim_prazo', models.DateField(blank=True, null=True, verbose_name='Data Fim Prazo')),
('tramitacao', models.BooleanField(verbose_name='Em Tramitação?')), ('tramitacao', models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], verbose_name='Em Tramitação?')),
('assunto', models.TextField(verbose_name='Assunto')), ('assunto', models.TextField(verbose_name='Assunto')),
('observacao', models.TextField(blank=True, null=True, verbose_name='Observação')), ('observacao', models.TextField(blank=True, verbose_name='Observação')),
('autor', models.ForeignKey(blank=True, null=True, to='materia.Autor')), ('texto_integral', models.FileField(blank=True, null=True, upload_to=sapl.protocoloadm.models.texto_upload_path, verbose_name='Texto Integral')),
('autor', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='materia.Autor')),
], ],
options={ options={
'verbose_name_plural': 'Documentos Administrativos',
'verbose_name': 'Documento Administrativo', 'verbose_name': 'Documento Administrativo',
'verbose_name_plural': 'Documentos Administrativos',
}, },
), ),
migrations.CreateModel( migrations.CreateModel(
name='Protocolo', name='Protocolo',
fields=[ fields=[
('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('numero', models.IntegerField(blank=True, null=True, verbose_name='Número do Protocolo')), ('numero', models.PositiveIntegerField(verbose_name='Número de Protocolo')),
('ano', models.SmallIntegerField()), ('ano', models.PositiveSmallIntegerField(choices=[(2016, 2016), (2015, 2015), (2014, 2014), (2013, 2013), (2012, 2012), (2011, 2011), (2010, 2010), (2009, 2009), (2008, 2008), (2007, 2007), (2006, 2006), (2005, 2005), (2004, 2004), (2003, 2003), (2002, 2002), (2001, 2001), (2000, 2000), (1999, 1999), (1998, 1998), (1997, 1997), (1996, 1996), (1995, 1995), (1994, 1994), (1993, 1993), (1992, 1992), (1991, 1991), (1990, 1990), (1989, 1989), (1988, 1988), (1987, 1987), (1986, 1986), (1985, 1985), (1984, 1984), (1983, 1983), (1982, 1982), (1981, 1981), (1980, 1980), (1979, 1979), (1978, 1978), (1977, 1977), (1976, 1976), (1975, 1975), (1974, 1974), (1973, 1973), (1972, 1972), (1971, 1971), (1970, 1970), (1969, 1969), (1968, 1968), (1967, 1967), (1966, 1966), (1965, 1965), (1964, 1964), (1963, 1963), (1962, 1962), (1961, 1961), (1960, 1960), (1959, 1959), (1958, 1958), (1957, 1957), (1956, 1956), (1955, 1955), (1954, 1954), (1953, 1953), (1952, 1952), (1951, 1951), (1950, 1950), (1949, 1949), (1948, 1948), (1947, 1947), (1946, 1946), (1945, 1945), (1944, 1944), (1943, 1943), (1942, 1942), (1941, 1941), (1940, 1940), (1939, 1939), (1938, 1938), (1937, 1937), (1936, 1936), (1935, 1935), (1934, 1934), (1933, 1933), (1932, 1932), (1931, 1931), (1930, 1930), (1929, 1929), (1928, 1928), (1927, 1927), (1926, 1926), (1925, 1925), (1924, 1924), (1923, 1923), (1922, 1922), (1921, 1921), (1920, 1920), (1919, 1919), (1918, 1918), (1917, 1917), (1916, 1916), (1915, 1915), (1914, 1914), (1913, 1913), (1912, 1912), (1911, 1911), (1910, 1910), (1909, 1909), (1908, 1908), (1907, 1907), (1906, 1906), (1905, 1905), (1904, 1904), (1903, 1903), (1902, 1902), (1901, 1901), (1900, 1900), (1899, 1899), (1898, 1898), (1897, 1897), (1896, 1896), (1895, 1895), (1894, 1894), (1893, 1893), (1892, 1892), (1891, 1891), (1890, 1890)], verbose_name='Ano do Protocolo')),
('data', models.DateField()), ('data', models.DateField()),
('hora', models.TimeField()), ('hora', models.TimeField()),
('timestamp', models.DateTimeField()), ('timestamp', models.DateTimeField()),
('tipo_protocolo', models.IntegerField(verbose_name='Tipo de Protocolo')), ('tipo_protocolo', models.PositiveIntegerField(verbose_name='Tipo de Protocolo')),
('tipo_processo', models.IntegerField()), ('tipo_processo', models.PositiveIntegerField()),
('interessado', models.CharField(blank=True, max_length=60, null=True, verbose_name='Interessado')), ('interessado', models.CharField(blank=True, max_length=60, verbose_name='Interessado')),
('assunto_ementa', models.TextField(blank=True, null=True)), ('assunto_ementa', models.TextField(blank=True)),
('numero_paginas', models.IntegerField(blank=True, null=True, verbose_name='Número de Páginas')), ('numero_paginas', models.PositiveIntegerField(blank=True, null=True, verbose_name='Número de Páginas')),
('observacao', models.TextField(blank=True, null=True, verbose_name='Observação')), ('observacao', models.TextField(blank=True, verbose_name='Observação')),
('anulado', models.BooleanField()), ('anulado', models.BooleanField()),
('user_anulacao', models.CharField(blank=True, max_length=20, null=True)), ('user_anulacao', models.CharField(blank=True, max_length=20)),
('ip_anulacao', models.CharField(blank=True, max_length=15, null=True)), ('ip_anulacao', models.CharField(blank=True, max_length=15)),
('justificativa_anulacao', models.CharField(blank=True, max_length=60, null=True)), ('justificativa_anulacao', models.CharField(blank=True, max_length=60, verbose_name='Motivo')),
('timestamp_anulacao', models.DateTimeField(blank=True, null=True)), ('timestamp_anulacao', models.DateTimeField(blank=True, null=True)),
('autor', models.ForeignKey(blank=True, null=True, to='materia.Autor')), ('autor', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='materia.Autor')),
], ],
options={ options={
'verbose_name_plural': 'Protocolos',
'verbose_name': 'Protocolo', 'verbose_name': 'Protocolo',
'verbose_name_plural': 'Protocolos',
}, },
), ),
migrations.CreateModel( migrations.CreateModel(
name='StatusTramitacaoAdministrativo', name='StatusTramitacaoAdministrativo',
fields=[ fields=[
('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('sigla', models.CharField(max_length=10, verbose_name='Sigla')), ('sigla', models.CharField(max_length=10, verbose_name='Sigla')),
('descricao', models.CharField(max_length=60, verbose_name='Descrição')), ('descricao', models.CharField(max_length=60, verbose_name='Descrição')),
('indicador', models.CharField(choices=[('F', 'Fim'), ('R', 'Retorno')], max_length=1, verbose_name='Indicador da Tramitação')), ('indicador', models.CharField(choices=[('F', 'Fim'), ('R', 'Retorno')], max_length=1, verbose_name='Indicador da Tramitação')),
], ],
options={ options={
'verbose_name_plural': 'Status de Tramitação',
'verbose_name': 'Status de Tramitação', 'verbose_name': 'Status de Tramitação',
'verbose_name_plural': 'Status de Tramitação',
}, },
), ),
migrations.CreateModel( migrations.CreateModel(
name='TipoDocumentoAdministrativo', name='TipoDocumentoAdministrativo',
fields=[ fields=[
('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('sigla', models.CharField(max_length=5, verbose_name='Sigla')), ('sigla', models.CharField(max_length=5, verbose_name='Sigla')),
('descricao', models.CharField(max_length=50, verbose_name='Descrição')), ('descricao', models.CharField(max_length=50, verbose_name='Descrição')),
], ],
options={ options={
'verbose_name_plural': 'Tipos de Documento Administrativo',
'verbose_name': 'Tipo de Documento Administrativo', 'verbose_name': 'Tipo de Documento Administrativo',
'verbose_name_plural': 'Tipos de Documento Administrativo',
},
),
migrations.CreateModel(
name='TipoInstituicao',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('descricao', models.CharField(max_length=50, verbose_name='Descrição')),
],
options={
'verbose_name': 'Tipo de Instituição',
'verbose_name_plural': 'Tipos de Instituições',
}, },
), ),
migrations.CreateModel( migrations.CreateModel(
name='TramitacaoAdministrativo', name='TramitacaoAdministrativo',
fields=[ fields=[
('id', models.AutoField(primary_key=True, verbose_name='ID', auto_created=True, serialize=False)), ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('data_tramitacao', models.DateField(blank=True, null=True, verbose_name='Data Tramitação')), ('data_tramitacao', models.DateField(verbose_name='Data Tramitação')),
('data_encaminhamento', models.DateField(blank=True, null=True, verbose_name='Data Encaminhamento')), ('data_encaminhamento', models.DateField(blank=True, null=True, verbose_name='Data Encaminhamento')),
('ultima', models.BooleanField()), ('texto', models.TextField(blank=True, verbose_name='Texto da Ação')),
('texto', models.TextField(blank=True, null=True, verbose_name='Texto da Ação')),
('data_fim_prazo', models.DateField(blank=True, null=True, verbose_name='Data Fim do Prazo')), ('data_fim_prazo', models.DateField(blank=True, null=True, verbose_name='Data Fim do Prazo')),
('documento', models.ForeignKey(to='protocoloadm.DocumentoAdministrativo')), ('documento', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='protocoloadm.DocumentoAdministrativo')),
('status', models.ForeignKey(blank=True, null=True, to='protocoloadm.StatusTramitacaoAdministrativo', verbose_name='Status')), ('status', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='protocoloadm.StatusTramitacaoAdministrativo', verbose_name='Status')),
('unidade_tramitacao_destino', models.ForeignKey(blank=True, null=True, to='materia.UnidadeTramitacao', verbose_name='Unidade Destino', related_name='+')), ('unidade_tramitacao_destino', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='adm_tramitacoes_destino', to='materia.UnidadeTramitacao', verbose_name='Unidade Destino')),
('unidade_tramitacao_local', models.ForeignKey(blank=True, null=True, to='materia.UnidadeTramitacao', verbose_name='Unidade Local', related_name='+')), ('unidade_tramitacao_local', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='adm_tramitacoes_origem', to='materia.UnidadeTramitacao', verbose_name='Unidade Local')),
], ],
options={ options={
'verbose_name_plural': 'Tramitações de Documento Administrativo',
'verbose_name': 'Tramitação de Documento Administrativo', 'verbose_name': 'Tramitação de Documento Administrativo',
'verbose_name_plural': 'Tramitações de Documento Administrativo',
}, },
), ),
migrations.AddField( migrations.AddField(
model_name='protocolo', model_name='protocolo',
name='tipo_documento', name='tipo_documento',
field=models.ForeignKey(blank=True, null=True, to='protocoloadm.TipoDocumentoAdministrativo', verbose_name='Tipo de documento'), field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='protocoloadm.TipoDocumentoAdministrativo', verbose_name='Tipo de documento'),
), ),
migrations.AddField( migrations.AddField(
model_name='protocolo', model_name='protocolo',
name='tipo_materia', name='tipo_materia',
field=models.ForeignKey(blank=True, null=True, to='materia.TipoMateriaLegislativa', verbose_name='Tipo Matéria'), field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='materia.TipoMateriaLegislativa', verbose_name='Tipo Matéria'),
), ),
migrations.AddField( migrations.AddField(
model_name='documentoadministrativo', model_name='documentoadministrativo',
name='tipo', name='tipo',
field=models.ForeignKey(to='protocoloadm.TipoDocumentoAdministrativo', verbose_name='Tipo Documento'), field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='protocoloadm.TipoDocumentoAdministrativo', verbose_name='Tipo Documento'),
), ),
migrations.AddField( migrations.AddField(
model_name='documentoacessorioadministrativo', model_name='documentoacessorioadministrativo',
name='documento', name='documento',
field=models.ForeignKey(to='protocoloadm.DocumentoAdministrativo'), field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='protocoloadm.DocumentoAdministrativo'),
), ),
migrations.AddField( migrations.AddField(
model_name='documentoacessorioadministrativo', model_name='documentoacessorioadministrativo',
name='tipo', name='tipo',
field=models.ForeignKey(to='protocoloadm.TipoDocumentoAdministrativo', verbose_name='Tipo'), field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='protocoloadm.TipoDocumentoAdministrativo', verbose_name='Tipo'),
), ),
] ]

59
sapl/protocoloadm/migrations/0002_auto_20150729_1717.py

@ -1,59 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('protocoloadm', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='documentoadministrativo',
name='ano',
field=models.PositiveSmallIntegerField(verbose_name='Ano'),
),
migrations.AlterField(
model_name='documentoadministrativo',
name='dias_prazo',
field=models.PositiveIntegerField(blank=True, verbose_name='Dias Prazo', null=True),
),
migrations.AlterField(
model_name='documentoadministrativo',
name='numero',
field=models.PositiveIntegerField(verbose_name='Número'),
),
migrations.AlterField(
model_name='documentoadministrativo',
name='numero_protocolo',
field=models.PositiveIntegerField(blank=True, verbose_name='Núm. Protocolo', null=True),
),
migrations.AlterField(
model_name='protocolo',
name='ano',
field=models.PositiveSmallIntegerField(),
),
migrations.AlterField(
model_name='protocolo',
name='numero',
field=models.PositiveIntegerField(blank=True, verbose_name='Número do Protocolo', null=True),
),
migrations.AlterField(
model_name='protocolo',
name='numero_paginas',
field=models.PositiveIntegerField(blank=True, verbose_name='Número de Páginas', null=True),
),
migrations.AlterField(
model_name='protocolo',
name='tipo_processo',
field=models.PositiveIntegerField(),
),
migrations.AlterField(
model_name='protocolo',
name='tipo_protocolo',
field=models.PositiveIntegerField(verbose_name='Tipo de Protocolo'),
),
]

22
sapl/protocoloadm/migrations/0003_documentoacessorioadministrativo_texto_integral.py

@ -1,22 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import sapl.protocoloadm.models
class Migration(migrations.Migration):
dependencies = [
('protocoloadm', '0002_auto_20150729_1717'),
]
operations = [
migrations.AddField(
model_name='documentoacessorioadministrativo',
name='texto_integral',
field=models.FileField(verbose_name='Texto Integral', blank=True,
null=True, upload_to=sapl.protocoloadm.models.texto_upload_path),
),
]

27
sapl/protocoloadm/migrations/0004_auto_20151007_1035.py

@ -1,27 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import sapl.protocoloadm.models
class Migration(migrations.Migration):
dependencies = [
('protocoloadm',
'0003_documentoacessorioadministrativo_texto_integral'),
]
operations = [
migrations.RemoveField(
model_name='documentoacessorioadministrativo',
name='texto_integral',
),
migrations.AddField(
model_name='documentoadministrativo',
name='texto_integral',
field=models.FileField(
blank=True, null=True, upload_to=sapl.protocoloadm.models.texto_upload_path, verbose_name='Texto Integral'),
),
]

22
sapl/protocoloadm/migrations/0005_auto_20151008_0744.py

@ -1,22 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import sapl.protocoloadm.models
class Migration(migrations.Migration):
dependencies = [
('protocoloadm', '0004_auto_20151007_1035'),
]
operations = [
migrations.AlterField(
model_name='documentoacessorioadministrativo',
name='arquivo',
field=models.FileField(
blank=True, null=True, upload_to=sapl.protocoloadm.models.texto_upload_path, verbose_name='Arquivo'),
),
]

74
sapl/protocoloadm/migrations/0006_auto_20160216_1015.py

@ -1,74 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('protocoloadm', '0005_auto_20151008_0744'),
]
operations = [
migrations.AlterField(
model_name='documentoacessorioadministrativo',
name='assunto',
field=models.TextField(verbose_name='Assunto', blank=True),
),
migrations.AlterField(
model_name='documentoacessorioadministrativo',
name='autor',
field=models.CharField(verbose_name='Autor', max_length=50, blank=True),
),
migrations.AlterField(
model_name='documentoacessorioadministrativo',
name='indexacao',
field=models.TextField(blank=True),
),
migrations.AlterField(
model_name='documentoadministrativo',
name='interessado',
field=models.CharField(verbose_name='Interessado', max_length=50, blank=True),
),
migrations.AlterField(
model_name='documentoadministrativo',
name='observacao',
field=models.TextField(verbose_name='Observação', blank=True),
),
migrations.AlterField(
model_name='protocolo',
name='assunto_ementa',
field=models.TextField(blank=True),
),
migrations.AlterField(
model_name='protocolo',
name='interessado',
field=models.CharField(verbose_name='Interessado', max_length=60, blank=True),
),
migrations.AlterField(
model_name='protocolo',
name='ip_anulacao',
field=models.CharField(max_length=15, blank=True),
),
migrations.AlterField(
model_name='protocolo',
name='justificativa_anulacao',
field=models.CharField(max_length=60, blank=True),
),
migrations.AlterField(
model_name='protocolo',
name='observacao',
field=models.TextField(verbose_name='Observação', blank=True),
),
migrations.AlterField(
model_name='protocolo',
name='user_anulacao',
field=models.CharField(max_length=20, blank=True),
),
migrations.AlterField(
model_name='tramitacaoadministrativo',
name='texto',
field=models.TextField(verbose_name='Texto da Ação', blank=True),
),
]

19
sapl/protocoloadm/migrations/0007_auto_20160218_1429.py

@ -1,19 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('protocoloadm', '0006_auto_20160216_1015'),
]
operations = [
migrations.AlterField(
model_name='documentoadministrativo',
name='tramitacao',
field=models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], verbose_name='Em Tramitação?'),
),
]

20
sapl/protocoloadm/migrations/0008_auto_20160308_1436.py

@ -1,20 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-03-08 17:36
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('protocoloadm', '0007_auto_20160218_1429'),
]
operations = [
migrations.AlterField(
model_name='protocolo',
name='ano',
field=models.PositiveSmallIntegerField(verbose_name='Ano do Protocolo'),
),
]

20
sapl/protocoloadm/migrations/0009_auto_20160309_1323.py

@ -1,20 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-03-09 16:23
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('protocoloadm', '0008_auto_20160308_1436'),
]
operations = [
migrations.AlterField(
model_name='protocolo',
name='numero',
field=models.PositiveIntegerField(verbose_name='Número de Protocolo'),
),
]

25
sapl/protocoloadm/migrations/0010_auto_20160309_1407.py

@ -1,25 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-03-09 17:07
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('protocoloadm', '0009_auto_20160309_1323'),
]
operations = [
migrations.AlterField(
model_name='documentoadministrativo',
name='ano',
field=models.PositiveSmallIntegerField(choices=[(2016, 2016), (2015, 2015), (2014, 2014), (2013, 2013), (2012, 2012), (2011, 2011), (2010, 2010), (2009, 2009), (2008, 2008), (2007, 2007), (2006, 2006), (2005, 2005), (2004, 2004), (2003, 2003), (2002, 2002), (2001, 2001), (2000, 2000), (1999, 1999), (1998, 1998), (1997, 1997), (1996, 1996), (1995, 1995), (1994, 1994), (1993, 1993), (1992, 1992), (1991, 1991), (1990, 1990), (1989, 1989), (1988, 1988), (1987, 1987), (1986, 1986), (1985, 1985), (1984, 1984), (1983, 1983), (1982, 1982), (1981, 1981), (1980, 1980), (1979, 1979), (1978, 1978), (1977, 1977), (1976, 1976), (1975, 1975), (1974, 1974), (1973, 1973), (1972, 1972), (1971, 1971), (1970, 1970), (1969, 1969), (1968, 1968), (1967, 1967), (1966, 1966), (1965, 1965), (1964, 1964), (1963, 1963), (1962, 1962), (1961, 1961), (1960, 1960), (1959, 1959), (1958, 1958), (1957, 1957), (1956, 1956), (1955, 1955), (1954, 1954), (1953, 1953), (1952, 1952), (1951, 1951), (1950, 1950), (1949, 1949), (1948, 1948), (1947, 1947), (1946, 1946), (1945, 1945), (1944, 1944), (1943, 1943), (1942, 1942), (1941, 1941), (1940, 1940), (1939, 1939), (1938, 1938), (1937, 1937), (1936, 1936), (1935, 1935), (1934, 1934), (1933, 1933), (1932, 1932), (1931, 1931), (1930, 1930), (1929, 1929), (1928, 1928), (1927, 1927), (1926, 1926), (1925, 1925), (1924, 1924), (1923, 1923), (1922, 1922), (1921, 1921), (1920, 1920), (1919, 1919), (1918, 1918), (1917, 1917), (1916, 1916), (1915, 1915), (1914, 1914), (1913, 1913), (1912, 1912), (1911, 1911), (1910, 1910), (1909, 1909), (1908, 1908), (1907, 1907), (1906, 1906), (1905, 1905), (1904, 1904), (1903, 1903), (1902, 1902), (1901, 1901), (1900, 1900), (1899, 1899), (1898, 1898), (1897, 1897), (1896, 1896), (1895, 1895), (1894, 1894), (1893, 1893), (1892, 1892), (1891, 1891), (1890, 1890)], verbose_name='Ano'),
),
migrations.AlterField(
model_name='protocolo',
name='ano',
field=models.PositiveSmallIntegerField(choices=[(2016, 2016), (2015, 2015), (2014, 2014), (2013, 2013), (2012, 2012), (2011, 2011), (2010, 2010), (2009, 2009), (2008, 2008), (2007, 2007), (2006, 2006), (2005, 2005), (2004, 2004), (2003, 2003), (2002, 2002), (2001, 2001), (2000, 2000), (1999, 1999), (1998, 1998), (1997, 1997), (1996, 1996), (1995, 1995), (1994, 1994), (1993, 1993), (1992, 1992), (1991, 1991), (1990, 1990), (1989, 1989), (1988, 1988), (1987, 1987), (1986, 1986), (1985, 1985), (1984, 1984), (1983, 1983), (1982, 1982), (1981, 1981), (1980, 1980), (1979, 1979), (1978, 1978), (1977, 1977), (1976, 1976), (1975, 1975), (1974, 1974), (1973, 1973), (1972, 1972), (1971, 1971), (1970, 1970), (1969, 1969), (1968, 1968), (1967, 1967), (1966, 1966), (1965, 1965), (1964, 1964), (1963, 1963), (1962, 1962), (1961, 1961), (1960, 1960), (1959, 1959), (1958, 1958), (1957, 1957), (1956, 1956), (1955, 1955), (1954, 1954), (1953, 1953), (1952, 1952), (1951, 1951), (1950, 1950), (1949, 1949), (1948, 1948), (1947, 1947), (1946, 1946), (1945, 1945), (1944, 1944), (1943, 1943), (1942, 1942), (1941, 1941), (1940, 1940), (1939, 1939), (1938, 1938), (1937, 1937), (1936, 1936), (1935, 1935), (1934, 1934), (1933, 1933), (1932, 1932), (1931, 1931), (1930, 1930), (1929, 1929), (1928, 1928), (1927, 1927), (1926, 1926), (1925, 1925), (1924, 1924), (1923, 1923), (1922, 1922), (1921, 1921), (1920, 1920), (1919, 1919), (1918, 1918), (1917, 1917), (1916, 1916), (1915, 1915), (1914, 1914), (1913, 1913), (1912, 1912), (1911, 1911), (1910, 1910), (1909, 1909), (1908, 1908), (1907, 1907), (1906, 1906), (1905, 1905), (1904, 1904), (1903, 1903), (1902, 1902), (1901, 1901), (1900, 1900), (1899, 1899), (1898, 1898), (1897, 1897), (1896, 1896), (1895, 1895), (1894, 1894), (1893, 1893), (1892, 1892), (1891, 1891), (1890, 1890)], verbose_name='Ano do Protocolo'),
),
]

20
sapl/protocoloadm/migrations/0011_auto_20160318_1504.py

@ -1,20 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-03-18 18:04
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('protocoloadm', '0010_auto_20160309_1407'),
]
operations = [
migrations.AlterField(
model_name='protocolo',
name='justificativa_anulacao',
field=models.CharField(blank=True, max_length=60, verbose_name='Motivo'),
),
]

26
sapl/protocoloadm/migrations/0012_auto_20160503_0926.py

@ -1,26 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-05-03 12:26
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('protocoloadm', '0011_auto_20160318_1504'),
]
operations = [
migrations.AlterField(
model_name='tramitacaoadministrativo',
name='unidade_tramitacao_destino',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='adm_tramitacoes_destino', to='materia.UnidadeTramitacao', verbose_name='Unidade Destino'),
),
migrations.AlterField(
model_name='tramitacaoadministrativo',
name='unidade_tramitacao_local',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='adm_tramitacoes_origem', to='materia.UnidadeTramitacao', verbose_name='Unidade Local'),
),
]

26
sapl/protocoloadm/migrations/0012_tipoinstituicao.py

@ -1,26 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-05-17 18:07
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('protocoloadm', '0011_auto_20160318_1504'),
]
operations = [
migrations.CreateModel(
name='TipoInstituicao',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('descricao', models.CharField(max_length=50, verbose_name='Descrição')),
],
options={
'verbose_name': 'Tipo de Instituição',
'verbose_name_plural': 'Tipos de Instituições',
},
),
]

16
sapl/protocoloadm/migrations/0013_merge.py

@ -1,16 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-05-19 17:03
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('protocoloadm', '0012_tipoinstituicao'),
('protocoloadm', '0012_auto_20160503_0926'),
]
operations = [
]

7
sapl/protocoloadm/models.py

@ -167,16 +167,12 @@ class StatusTramitacaoAdministrativo(models.Model):
class TramitacaoAdministrativo(models.Model): class TramitacaoAdministrativo(models.Model):
status = models.ForeignKey( status = models.ForeignKey(
StatusTramitacaoAdministrativo, StatusTramitacaoAdministrativo,
blank=True,
null=True,
verbose_name=_('Status')) verbose_name=_('Status'))
documento = models.ForeignKey(DocumentoAdministrativo) documento = models.ForeignKey(DocumentoAdministrativo)
data_tramitacao = models.DateField( data_tramitacao = models.DateField(
blank=True, null=True, verbose_name=_('Data Tramitação')) verbose_name=_('Data Tramitação'))
unidade_tramitacao_local = models.ForeignKey( unidade_tramitacao_local = models.ForeignKey(
UnidadeTramitacao, UnidadeTramitacao,
blank=True,
null=True,
related_name='adm_tramitacoes_origem', related_name='adm_tramitacoes_origem',
verbose_name=_('Unidade Local')) verbose_name=_('Unidade Local'))
data_encaminhamento = models.DateField( data_encaminhamento = models.DateField(
@ -187,7 +183,6 @@ class TramitacaoAdministrativo(models.Model):
null=True, null=True,
related_name='adm_tramitacoes_destino', related_name='adm_tramitacoes_destino',
verbose_name=_('Unidade Destino')) verbose_name=_('Unidade Destino'))
ultima = models.BooleanField()
texto = models.TextField( texto = models.TextField(
blank=True, verbose_name=_('Texto da Ação')) blank=True, verbose_name=_('Texto da Ação'))
data_fim_prazo = models.DateField( data_fim_prazo = models.DateField(

20
sapl/protocoloadm/urls.py

@ -23,11 +23,8 @@ from sapl.protocoloadm.views import (AnularProtocoloAdmView,
StatusTramitacaoAdministrativoCrud, StatusTramitacaoAdministrativoCrud,
TipoDocumentoAdministrativoCrud, TipoDocumentoAdministrativoCrud,
TipoInstituicaoCrud, TipoInstituicaoCrud,
TramitacaoAdmDeleteView, TramitacaoAdmCrud,
TramitacaoAdmEditView, get_nome_autor,
TramitacaoAdmIncluirView,
TramitacaoAdministrativoCrud,
TramitacaoAdmView, get_nome_autor,
pesquisa_autores) pesquisa_autores)
from .apps import AppConfig from .apps import AppConfig
@ -36,7 +33,8 @@ app_name = AppConfig.name
urlpatterns = [ urlpatterns = [
url(r'^protocoloadm/docadm/', url(r'^protocoloadm/docadm/',
include(DocumentoAdministrativoCrud.get_urls())), include(DocumentoAdministrativoCrud.get_urls() +
TramitacaoAdmCrud.get_urls())),
url(r'^protocoloadm/tipo-documento-adm/', url(r'^protocoloadm/tipo-documento-adm/',
include(TipoDocumentoAdministrativoCrud.get_urls())), include(TipoDocumentoAdministrativoCrud.get_urls())),
url(r'^protocoloadm/doc-acessorio/', url(r'^protocoloadm/doc-acessorio/',
@ -45,8 +43,6 @@ urlpatterns = [
include(StatusTramitacaoAdministrativoCrud.get_urls())), include(StatusTramitacaoAdministrativoCrud.get_urls())),
url(r'^protocoloadm/tipo-instituicao/', url(r'^protocoloadm/tipo-instituicao/',
include(TipoInstituicaoCrud.get_urls())), include(TipoInstituicaoCrud.get_urls())),
url(r'^protocoloadm/tramitacao-adm/',
include(TramitacaoAdministrativoCrud.get_urls())),
url(r'^protocoloadm/protocolo-doc/', url(r'^protocoloadm/protocolo-doc/',
include(ProtocoloDocumentoCrud.get_urls())), include(ProtocoloDocumentoCrud.get_urls())),
url(r'^protocoloadm/protocolo-mat/', url(r'^protocoloadm/protocolo-mat/',
@ -73,14 +69,6 @@ urlpatterns = [
DocumentoAcessorioAdministrativoEditView.as_view(), DocumentoAcessorioAdministrativoEditView.as_view(),
name='doc_ace_adm_edit'), name='doc_ace_adm_edit'),
url(r'^protocoloadm/(?P<pk>\d+)/tramitacao$',
TramitacaoAdmView.as_view(), name='tramitacao_adm'),
url(r'^protocoloadm/(?P<pk>\d+)/tramitacao_incluir',
TramitacaoAdmIncluirView.as_view(), name='tramitacao_incluir'),
url(r'^protocoloadm/(?P<pk>\d+)/tramitacao_edit',
TramitacaoAdmEditView.as_view(), name='tramitacao_edit'),
url(r'^protocoloadm/(?P<pk>\d+)/tramitacao_delete/(?P<oid>\d+)',
TramitacaoAdmDeleteView.as_view(), name='tramitacao_delete'),
url(r'^protocoloadm/(?P<pk>\d+)/(?P<ano>\d+)/comprovante$', url(r'^protocoloadm/(?P<pk>\d+)/(?P<ano>\d+)/comprovante$',
ComprovanteProtocoloView.as_view(), name='comprovante_protocolo'), ComprovanteProtocoloView.as_view(), name='comprovante_protocolo'),

142
sapl/protocoloadm/views.py

@ -1,6 +1,8 @@
import json import json
from datetime import date, datetime from datetime import date, datetime
import sapl.crud.base
from sapl.crud.masterdetail import MasterDetailCrud
from braces.views import FormValidMessageMixin from braces.views import FormValidMessageMixin
from django.contrib.auth.mixins import PermissionRequiredMixin from django.contrib.auth.mixins import PermissionRequiredMixin
from django.core.exceptions import ObjectDoesNotExist from django.core.exceptions import ObjectDoesNotExist
@ -23,7 +25,8 @@ from .forms import (AnularProcoloAdmForm, DocumentoAcessorioAdministrativoForm,
DocumentoAdministrativoFilterSet, DocumentoAdministrativoFilterSet,
DocumentoAdministrativoForm, ProposicaoSimpleForm, DocumentoAdministrativoForm, ProposicaoSimpleForm,
ProtocoloDocumentForm, ProtocoloFilterSet, ProtocoloDocumentForm, ProtocoloFilterSet,
ProtocoloMateriaForm, TramitacaoAdmForm) ProtocoloMateriaForm, TramitacaoAdmForm,
TramitacaoAdmEditForm)
from .models import (Autor, DocumentoAcessorioAdministrativo, from .models import (Autor, DocumentoAcessorioAdministrativo,
DocumentoAdministrativo, Protocolo, DocumentoAdministrativo, Protocolo,
StatusTramitacaoAdministrativo, StatusTramitacaoAdministrativo,
@ -31,16 +34,33 @@ from .models import (Autor, DocumentoAcessorioAdministrativo,
TramitacaoAdministrativo) TramitacaoAdministrativo)
TipoDocumentoAdministrativoCrud = Crud.build(TipoDocumentoAdministrativo, '') TipoDocumentoAdministrativoCrud = Crud.build(TipoDocumentoAdministrativo, '')
DocumentoAdministrativoCrud = Crud.build(DocumentoAdministrativo, '')
DocumentoAcessorioAdministrativoCrud = Crud.build( DocumentoAcessorioAdministrativoCrud = Crud.build(
DocumentoAcessorioAdministrativo, '') DocumentoAcessorioAdministrativo, '')
TramitacaoAdministrativoCrud = Crud.build(TramitacaoAdministrativo, '')
ProtocoloDocumentoCrud = Crud.build(Protocolo, '') ProtocoloDocumentoCrud = Crud.build(Protocolo, '')
# FIXME precisa de uma chave diferente para o layout # FIXME precisa de uma chave diferente para o layout
ProtocoloMateriaCrud = Crud.build(Protocolo, '') ProtocoloMateriaCrud = Crud.build(Protocolo, '')
TipoInstituicaoCrud = Crud.build(TipoInstituicao, '') TipoInstituicaoCrud = Crud.build(TipoInstituicao, '')
class DocumentoAdministrativoCrud(Crud):
model = DocumentoAdministrativo
help_path = ''
class BaseMixin(sapl.crud.base.CrudBaseMixin):
list_field_names = ['tipo', 'numero', 'ano', 'data',
'numero_protocolo', 'assunto',
'interessado', 'tramitacao', 'texto_integral']
class CreateView(PermissionRequiredMixin, CrudCreateView):
permission_required = permissoes_adm()
class UpdateView(PermissionRequiredMixin, CrudUpdateView):
permission_required = permissoes_adm()
class DeleteView(PermissionRequiredMixin, CrudDeleteView):
permission_required = permissoes_adm()
class StatusTramitacaoAdministrativoCrud(Crud): class StatusTramitacaoAdministrativoCrud(Crud):
model = StatusTramitacaoAdministrativo model = StatusTramitacaoAdministrativo
help_path = '' help_path = ''
@ -172,7 +192,9 @@ class AnularProtocoloAdmView(PermissionRequiredMixin, CreateView):
return redirect(self.get_success_url()) return redirect(self.get_success_url())
class ProtocoloDocumentoView(PermissionRequiredMixin, FormValidMessageMixin, CreateView): class ProtocoloDocumentoView(PermissionRequiredMixin,
FormValidMessageMixin,
CreateView):
template_name = "protocoloadm/protocolar_documento.html" template_name = "protocoloadm/protocolar_documento.html"
form_class = ProtocoloDocumentForm form_class = ProtocoloDocumentForm
form_valid_message = _('Protocolo cadastrado com sucesso!') form_valid_message = _('Protocolo cadastrado com sucesso!')
@ -388,7 +410,8 @@ class ProposicaoDetailView(DetailView):
return context return context
class PesquisarDocumentoAdministrativoView(PermissionRequiredMixin, FilterView): class PesquisarDocumentoAdministrativoView(PermissionRequiredMixin,
FilterView):
model = DocumentoAdministrativo model = DocumentoAdministrativo
filterset_class = DocumentoAdministrativoFilterSet filterset_class = DocumentoAdministrativoFilterSet
paginate_by = 10 paginate_by = 10
@ -489,7 +512,8 @@ class DetailDocumentoAdministrativo(PermissionRequiredMixin, DetailView):
'pk': self.kwargs['pk']}) 'pk': self.kwargs['pk']})
class DocumentoAcessorioAdministrativoEditView(PermissionRequiredMixin, FormView): class DocumentoAcessorioAdministrativoEditView(PermissionRequiredMixin,
FormView):
template_name = "protocoloadm/documento_acessorio_administrativo_edit.html" template_name = "protocoloadm/documento_acessorio_administrativo_edit.html"
permission_required = permissoes_adm() permission_required = permissoes_adm()
@ -549,8 +573,8 @@ class DocumentoAcessorioAdministrativoView(PermissionRequiredMixin, FormView):
doc_acessorio = DocumentoAcessorioAdministrativo.objects.filter( doc_acessorio = DocumentoAcessorioAdministrativo.objects.filter(
documento_id=kwargs['pk']) documento_id=kwargs['pk'])
if not doc_acessorio: if not doc_acessorio:
doc_ace_null = _('Nenhum documento acessório \ doc_ace_null = _('Nenhum documento acessório' +
cadastrado para este processo.') 'cadastrado para este processo.')
return self.render_to_response({'pk': kwargs['pk'], return self.render_to_response({'pk': kwargs['pk'],
'doc': doc, 'doc': doc,
@ -577,94 +601,30 @@ class DocumentoAcessorioAdministrativoView(PermissionRequiredMixin, FormView):
return reverse('sapl.protocoloadm:doc_ace_adm', kwargs={'pk': pk}) return reverse('sapl.protocoloadm:doc_ace_adm', kwargs={'pk': pk})
class TramitacaoAdmView(PermissionRequiredMixin, FormView): class TramitacaoAdmCrud(MasterDetailCrud):
template_name = "protocoloadm/tramitacao.html" model = TramitacaoAdministrativo
permission_required = permissoes_adm() parent_field = 'documento'
help_path = ''
def get(self, request, *args, **kwargs):
pk = kwargs['pk']
documento = DocumentoAdministrativo.objects.get(id=pk)
tramitacoes = TramitacaoAdministrativo.objects.filter(
documento=documento).order_by('-data_tramitacao')
return self.render_to_response({'documento': documento,
'tramitacoes': tramitacoes})
class TramitacaoAdmIncluirView(PermissionRequiredMixin, FormView):
template_name = "protocoloadm/tramitacao_incluir.html"
permission_required = permissoes_adm()
def get(self, request, *args, **kwargs):
pk = kwargs['pk']
documento = DocumentoAdministrativo.objects.get(id=pk)
data = {'documento': documento}
form = TramitacaoAdmForm(initial=data)
return self.render_to_response({'documento': documento, 'form': form})
def post(self, request, *args, **kwargs):
pk = kwargs['pk']
form = TramitacaoAdmForm(request.POST or None)
if form.is_valid():
tramitacao = form.save(commit=False)
tramitacao.ultima = False
tramitacao.save()
return HttpResponseRedirect(reverse(
'sapl.protocoloadm:tramitacao_adm', kwargs={'pk': pk}))
else:
return self.form_invalid(form)
class TramitacaoAdmEditView(PermissionRequiredMixin, FormView):
template_name = "protocoloadm/tramitacao_edit.html"
permission_required = permissoes_adm()
def get(self, request, *args, **kwargs):
pk = kwargs['pk']
tramitacao = TramitacaoAdministrativo.objects.get(id=pk)
documento = tramitacao.documento
form = TramitacaoAdmForm(instance=tramitacao)
return self.render_to_response({'documento': documento, 'form': form})
def post(self, request, *args, **kwargs):
pk = kwargs['pk']
tramitacao = TramitacaoAdministrativo.objects.get(id=pk)
form = TramitacaoAdmForm(request.POST, instance=tramitacao)
if form.is_valid():
tramitacao = form.save(commit=False)
tramitacao.ultima = False
tramitacao.save()
return HttpResponseRedirect(
reverse('sapl.protocoloadm:tramitacao_adm',
kwargs={'pk': tramitacao.documento.id}))
else:
return self.form_invalid(form)
class TramitacaoAdmDeleteView(PermissionRequiredMixin, DetailView):
template_name = "protocoloadm/tramitacao.html" class BaseMixin(MasterDetailCrud.BaseMixin):
permission_required = permissoes_adm() list_field_names = ['data_tramitacao', 'unidade_tramitacao_local',
'unidade_tramitacao_destino', 'status']
def get(self, request, *args, **kwargs): class CreateView(PermissionRequiredMixin, MasterDetailCrud.CreateView):
pk = kwargs['pk'] form_class = TramitacaoAdmForm
oid = kwargs['oid'] permission_required = permissoes_adm()
documento = DocumentoAdministrativo.objects.get(id=pk) class UpdateView(PermissionRequiredMixin, MasterDetailCrud.UpdateView):
form_class = TramitacaoAdmEditForm
permission_required = permissoes_adm()
tramitacao = TramitacaoAdministrativo.objects.get(id=oid) class ListView(PermissionRequiredMixin, MasterDetailCrud.ListView):
tramitacao.delete() permission_required = permissoes_adm()
tramitacoes = TramitacaoAdministrativo.objects.filter(
documento=documento)
return self.render_to_response({'documento': documento, def get_queryset(self):
'tramitacoes': tramitacoes}) qs = super(MasterDetailCrud.ListView, self).get_queryset()
kwargs = {self.crud.parent_field: self.kwargs['pk']}
return qs.filter(**kwargs).order_by('-id')
def get_nome_autor(request): def get_nome_autor(request):

12
sapl/templates/base.html

@ -59,12 +59,20 @@
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Protocolo <span class="caret"></span></a> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Protocolo <span class="caret"></span></a>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li class="nav__sub-item"><a class="nav__sub-link" href="{% url 'sapl.protocoloadm:protocolo' %}">Pesquisar Protocolo</a></li> <li class="nav__sub-item"><a class="nav__sub-link" href="{% url 'sapl.protocoloadm:protocolo' %}">Pesquisar Protocolo</a></li>
<li class="nav__sub-item"><a class="nav__sub-link" href="{% url 'sapl.protocoloadm:pesq_doc_adm' %}">Pesquisar Documento Administrativo</a></li>
<!-- <li class="nav__sub-item"><a class="nav__sub-link" href="/materia">Protocolo Legislativo</a></li> --> <!-- <li class="nav__sub-item"><a class="nav__sub-link" href="/materia">Protocolo Legislativo</a></li> -->
{# <li class="nav__sub-item"><a class="nav__sub-link" href="">Protocolo Geral</a></li> #} {# <li class="nav__sub-item"><a class="nav__sub-link" href="">Protocolo Geral</a></li> #}
{# <li class="nav__sub-item"><a class="nav__sub-link" href="{% url 'sapl.protocoloadm:proposicao' %}">Proposições</a></li> #} {# <li class="nav__sub-item"><a class="nav__sub-link" href="{% url 'sapl.protocoloadm:proposicao' %}">Proposições</a></li> #}
</ul> </ul>
</li> </li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Documentos Administrativos <span class="caret"></span></a>
<ul class="dropdown-menu">
<li class="nav__sub-item"><a class="nav__sub-link" href="{% url 'sapl.protocoloadm:pesq_doc_adm' %}">Pesquisar Documento Administrativo</a></li>
</ul>
</li>
<li class="dropdown">
{% endif %} {% endif %}
<li class="dropdown"> <li class="dropdown">

4
sapl/templates/materia/materialegislativa_filter.html

@ -11,7 +11,7 @@
<br></br> <br></br>
{% if filter_url %} {% if filter_url %}
<div class="actions btn-group pull-right" role="group"> <div class="actions btn-group pull-right" role="group">
<a href="{% url 'sapl.materia:pesquisar_materia' %}" class="btn btn-default">{% trans 'Fazer nova pesquisa' %}</a> <a href="{% url 'materia:pesquisar_materia' %}" class="btn btn-default">{% trans 'Fazer nova pesquisa' %}</a>
</div> </div>
{% endif %} {% endif %}
@ -35,7 +35,7 @@
<tr> <tr>
<td> <td>
<strong><a href="{% url 'sapl.materia:materialegislativa_detail' m.id %}">{{m.tipo.sigla}} {{m.numero}}/{{m.ano}} - {{m.tipo}}</strong></a></br> <strong><a href="{% url 'materia:materialegislativa_detail' m.id %}">{{m.tipo.sigla}} {{m.numero}}/{{m.ano}} - {{m.tipo}}</strong></a></br>
<strong>Autores:</strong> <strong>Autores:</strong>
{% for a in m.autoria_set.all %} {% for a in m.autoria_set.all %}
{% if not forloop.first %} {% if not forloop.first %}

9
sapl/templates/protocoloadm/documentoadministrativo_detail.html

@ -0,0 +1,9 @@
{% extends "crud/detail.html" %}
{% load i18n %}
{% block actions %}
<div class="actions btn-group pull-right" role="group">
<a href="{% url 'protocoloadm:tramitacaoadministrativo_list' object.pk %}" class="btn btn-default">{% trans 'Tramitações' %}</a>
<a href="{{ view.update_url }}" class="btn btn-default">{% trans 'Editar' %}</a>
<a href="{{ view.delete_url }}" class="btn btn-default">{% trans 'Excluir' %}</a>
</div>
{% endblock actions %}

30
sapl/templates/protocoloadm/documentoadministrativo_filter.html

@ -1,16 +1,34 @@
{% extends "crud/detail.html" %} {% extends "crud/detail.html" %}
{% load i18n %} {% load i18n %}
{% load crispy_forms_tags %} {% load crispy_forms_tags %}
{% block actions %}{% endblock %} {% load common_tags %}
{% block sections_nav %} {% endblock %} {% block sections_nav %} {% endblock %}
{% block actions %}
<h1><b>Documentos Administrativos</b></h1>
<div class="actions btn-group pull-right" role="group">
{% if perms|get_add_perm:view %}
<a href="docadm/create" class="btn btn-default">{% trans 'Adicionar Documento Administrativo' %}</a>
{% endif %}
</div>
{% if filter_url %}
<div class="actions btn-group pull-right" role="group">
<a href="{% url 'protocoloadm:pesq_doc_adm' %}" class="btn btn-default">{% trans 'Fazer Nova Pesquisa' %}</a>
</div>
{% endif %}
{% endblock actions %}
{% block detail_content %} {% block detail_content %}
<h1><b>Pesquisar Documento Administrativo</b></h1>
<br></br>
{% crispy filter.form %} {% if not filter_url %}
{% crispy filter.form %}
{% endif %}
{% if filter_url %} {% if filter_url %}
<p></p> <p></p>
<table class="table table-striped table-bordered"> <table class="table table-striped table-bordered">
@ -28,7 +46,7 @@
<tr> <tr>
<td> <td>
<strong><a href="{% url 'sapl.protocoloadm:documentoadministrativo_detail' d.id %}">{{d.tipo.sigla}} {{d.numero}}/{{d.ano}} - {{d.tipo}}</strong></a></br> <strong><a href="{% url 'protocoloadm:documentoadministrativo_detail' d.id %}">{{d.tipo.sigla}} {{d.numero}}/{{d.ano}} - {{d.tipo}}</strong></a></br>
<strong>Interessado:</strong>&nbsp;{{ d.interessado|default_if_none:"Não Informado"}}</br> <strong>Interessado:</strong>&nbsp;{{ d.interessado|default_if_none:"Não Informado"}}</br>
<strong>Assunto:</strong>&nbsp;{{ d.assunto|safe }}</br> <strong>Assunto:</strong>&nbsp;{{ d.assunto|safe }}</br>
<p></p> <p></p>

8
sapl/templates/protocoloadm/protocolo_filter.html

@ -10,7 +10,7 @@
<br></br> <br></br>
{% if filter_url %} {% if filter_url %}
<div class="actions btn-group pull-right" role="group"> <div class="actions btn-group pull-right" role="group">
<a href="{% url 'sapl.protocoloadm:protocolo' %}" class="btn btn-default">{% trans 'Fazer nova pesquisa' %}</a> <a href="{% url 'protocoloadm:protocolo' %}" class="btn btn-default">{% trans 'Fazer nova pesquisa' %}</a>
</div> </div>
{% endif %} {% endif %}
@ -37,12 +37,12 @@
<tr> <tr>
<td> <td>
<strong>Protocolo: <strong>Protocolo:
<a href="{% url 'sapl.protocoloadm:protocolo_mostrar' p.numero p.ano %}"> <a href="{% url 'protocoloadm:protocolo_mostrar' p.numero p.ano %}">
{{ p.numero|stringformat:'06d' }}/{{ p.ano }} {{ p.numero|stringformat:'06d' }}/{{ p.ano }}
</a></strong> </a></strong>
&nbsp;&nbsp;<strong>-</strong>&nbsp;&nbsp; &nbsp;&nbsp;<strong>-</strong>&nbsp;&nbsp;
<a href="{% url 'sapl.relatorios:relatorio_etiqueta_protocolo' p.numero p.ano %}"> <a href="{% url 'relatorios:relatorio_etiqueta_protocolo' p.numero p.ano %}">
<img src="{% static 'img/etiqueta.png' %}" alt="Etiqueta Individual"> <img src="{% static 'img/etiqueta.png' %}" alt="Etiqueta Individual">
</a></br> </a></br>
@ -77,4 +77,4 @@
{% endif %} {% endif %}
{% endblock detail_content %} {% endblock detail_content %}

9
sapl/templates/protocoloadm/protocolo_pesquisa.html

@ -1,9 +0,0 @@
{% extends "protocoloadm/protocoloadm_detail.html" %}
{% load i18n %}
{% load crispy_forms_tags %}
{% block detail_content %}
<legend>Pesquisa Avançada</legend>
{% crispy form %}
</fieldset>
{% endblock detail_content %}

8
sapl/templates/protocoloadm/protocoloadm_detail.html

@ -2,8 +2,8 @@
{% load i18n %} {% load i18n %}
{% block actions %} {% block actions %}
<div class="actions btn-group pull-right" role="group"> <div class="actions btn-group pull-right" role="group">
<a href="{% url 'sapl.protocoloadm:protocolar_doc' %}" class="btn btn-default">{% trans 'Protocolar Documento' %}</a> <a href="{% url 'protocoloadm:protocolar_doc' %}" class="btn btn-default">{% trans 'Protocolar Documento' %}</a>
<a href="{% url 'sapl.protocoloadm:protocolar_mat' %}" class="btn btn-default">{% trans 'Protocolar Matéria' %}</a> <a href="{% url 'protocoloadm:protocolar_mat' %}" class="btn btn-default">{% trans 'Protocolar Matéria' %}</a>
<a href="{% url 'sapl.protocoloadm:anular_protocolo' %}" class="btn btn-default">{% trans 'Anular Protocolo' %}</a> <a href="{% url 'protocoloadm:anular_protocolo' %}" class="btn btn-default">{% trans 'Anular Protocolo' %}</a>
</div> </div>
{% endblock actions %} {% endblock actions %}

40
sapl/templates/protocoloadm/tramitacao.html

@ -1,40 +0,0 @@
{% extends "protocoloadm/protocoloadm_detail.html" %}
{% load i18n %}
{% load crispy_forms_tags %}
{% block detail_content %}
<fieldset>
Tipo: {{documento.tipo.sigla}} Número: {{documento.numero}} Ano: {{documento.ano}}</br>
Assunto: {{documento.assunto}}
</fieldset>
<fieldset>
<h2>Tramitação</h2>
{% if tramitacoes %}
<table>
<tr>
<td>Data Ação</td>
<td>Origem</td>
<td>Destino</td>
<td>Status</td>
<td>Excluir</td>
</tr>
{% for t in tramitacoes %}
<tr>
<td><a href="{% url 'sapl.protocoloadm:tramitacao_edit' t.id %}">{{t.data_encaminhamento|date:"d/m/Y"}}</a></td>
<td>{{t.unidade_tramitacao_local}}</td>
<td>{{t.unidade_tramitacao_destino}}</td>
<td>{{t.status.sigla}}</td>
<td><a href="{% url 'sapl.protocoloadm:tramitacao_delete' documento.id t.id %}">Excluir</ad></td>
</tr>
{% endfor %}
</table>
{% else %}
<strong>Nenhuma tramitação cadastrada para este documento.</strong>
{% endif %}
</br>
<a href="{% url 'sapl.protocoloadm:tramitacao_incluir' documento.id %}" class="button primary">Incluir Tramitação</a>
</fieldset>
{% endblock detail_content %}

15
sapl/templates/protocoloadm/tramitacao_edit.html

@ -1,15 +0,0 @@
{% extends "protocoloadm/protocoloadm_detail.html" %}
{% load i18n %}
{% load crispy_forms_tags %}
{% block detail_content %}
<fieldset>
Tipo: {{documento.tipo.sigla}} Número: {{documento.numero}} Ano: {{documento.ano}}</br>
Assunto: {{documento.assunto}}
</fieldset>
<h2>Tramitação Edit</h2>
{% crispy form %}
{% endblock detail_content %}

14
sapl/templates/protocoloadm/tramitacao_incluir.html

@ -1,14 +0,0 @@
{% extends "protocoloadm/protocoloadm_detail.html" %}
{% load i18n %}
{% load crispy_forms_tags %}
{% block detail_content %}
<fieldset>
Tipo: {{documento.tipo.sigla}} Número: {{documento.numero}} Ano: {{documento.ano}}</br>
Assunto: {{documento.assunto}}
</fieldset>
<h2>Tramitação</h2>
{% crispy form %}
{% endblock detail_content %}

9
sapl/templates/protocoloadm/tramitacaoadministrativo_detail.html

@ -0,0 +1,9 @@
{% extends "crud/detail.html" %}
{% load i18n %}
{% block actions %}
<div class="actions btn-group pull-right" role="group">
<a href="{% url 'protocoloadm:documentoadministrativo_detail' root_pk %}" class="btn btn-default">{% trans 'Início' %}</a>
<a href="{{ view.update_url }}" class="btn btn-default">{% trans 'Editar' %}</a>
<a href="{{ view.delete_url }}" class="btn btn-default">{% trans 'Excluir' %}</a>
</div>
{% endblock actions %}
Loading…
Cancel
Save