Browse Source

Adiciona choices em materia, norma, protocoloadm, e move RANGE_ANOS para sapl/utils.py (+ QA fixes)

pull/261/head
Edward Ribeiro 9 years ago
parent
commit
b6d59e8f27
  1. 1
      base/models.py
  2. 3
      materia/forms.py
  3. 12
      materia/models.py
  4. 5
      norma/models.py
  5. 2
      parlamentares/models.py
  6. 11
      protocoloadm/models.py
  7. 2
      relatorios/views.py
  8. 3
      sapl/utils.py

1
base/models.py

@ -1,5 +1,6 @@
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 sapl.utils import UF from sapl.utils import UF

3
materia/forms.py

@ -1,7 +1,7 @@
from datetime import date from datetime import date
from crispy_forms.helper import FormHelper from crispy_forms.helper import FormHelper
from crispy_forms.layout import Column, Fieldset, Layout from crispy_forms.layout import Column, Fieldset, Layout, Submit
from django import forms from django import forms
from django.forms import ModelForm from django.forms import ModelForm
from django.utils.safestring import mark_safe from django.utils.safestring import mark_safe
@ -54,7 +54,6 @@ class HorizontalRadioRenderer(forms.RadioSelect.renderer):
class ProposicaoForm(ModelForm): class ProposicaoForm(ModelForm):
tipo_materia = forms.ModelChoiceField( tipo_materia = forms.ModelChoiceField(
label=_('Matéria Vinculada'), label=_('Matéria Vinculada'),
required=False, required=False,

12
materia/models.py

@ -1,12 +1,10 @@
from datetime import date
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
from comissoes.models import Comissao from comissoes.models import Comissao
from parlamentares.models import Parlamentar, Partido from parlamentares.models import Parlamentar, Partido
from sapl.utils import YES_NO_CHOICES, xstr from sapl.utils import RANGE_ANOS, YES_NO_CHOICES, xstr
class TipoMateriaLegislativa(models.Model): class TipoMateriaLegislativa(models.Model):
@ -64,7 +62,8 @@ class MateriaLegislativa(models.Model):
tipo = models.ForeignKey(TipoMateriaLegislativa, verbose_name=_('Tipo')) tipo = models.ForeignKey(TipoMateriaLegislativa, verbose_name=_('Tipo'))
numero = models.PositiveIntegerField(verbose_name=_('Número')) numero = models.PositiveIntegerField(verbose_name=_('Número'))
ano = models.PositiveSmallIntegerField(verbose_name=_('Ano')) ano = models.PositiveSmallIntegerField(verbose_name=_('Ano'),
choices=RANGE_ANOS)
numero_protocolo = models.PositiveIntegerField( numero_protocolo = models.PositiveIntegerField(
blank=True, null=True, verbose_name=_('Núm. Protocolo')) blank=True, null=True, verbose_name=_('Núm. Protocolo'))
data_apresentacao = models.DateField(verbose_name=_('Data Apresentação')) data_apresentacao = models.DateField(verbose_name=_('Data Apresentação'))
@ -85,7 +84,7 @@ class MateriaLegislativa(models.Model):
numero_origem_externa = models.CharField( numero_origem_externa = models.CharField(
max_length=5, blank=True, verbose_name=_('Número')) max_length=5, blank=True, verbose_name=_('Número'))
ano_origem_externa = models.PositiveSmallIntegerField( ano_origem_externa = models.PositiveSmallIntegerField(
blank=True, null=True, verbose_name=_('Ano')) blank=True, null=True, verbose_name=_('Ano'), choices=RANGE_ANOS)
data_origem_externa = models.DateField( data_origem_externa = models.DateField(
blank=True, null=True, verbose_name=_('Data')) blank=True, null=True, verbose_name=_('Data'))
local_origem_externa = models.ForeignKey( local_origem_externa = models.ForeignKey(
@ -302,9 +301,6 @@ class MateriaAssunto(models.Model):
'materia': self.materia, 'assunto': self.assunto} 'materia': self.materia, 'assunto': self.assunto}
RANGE_ANOS = [(year, year) for year in range(date.today().year, 1889, -1)]
class Numeracao(models.Model): class Numeracao(models.Model):
materia = models.ForeignKey(MateriaLegislativa) materia = models.ForeignKey(MateriaLegislativa)
tipo_materia = models.ForeignKey( tipo_materia = models.ForeignKey(

5
norma/models.py

@ -4,7 +4,7 @@ from django.utils.translation import ugettext_lazy as _
from model_utils import Choices from model_utils import Choices
from materia.models import MateriaLegislativa from materia.models import MateriaLegislativa
from sapl.utils import YES_NO_CHOICES from sapl.utils import RANGE_ANOS, YES_NO_CHOICES
class AssuntoNorma(models.Model): class AssuntoNorma(models.Model):
@ -76,7 +76,8 @@ class NormaJuridica(models.Model):
TipoNormaJuridica, verbose_name=_('Tipo da Norma Juridica')) TipoNormaJuridica, verbose_name=_('Tipo da Norma Juridica'))
materia = models.ForeignKey(MateriaLegislativa, blank=True, null=True) materia = models.ForeignKey(MateriaLegislativa, blank=True, null=True)
numero = models.PositiveIntegerField(verbose_name=_('Número')) numero = models.PositiveIntegerField(verbose_name=_('Número'))
ano = models.PositiveSmallIntegerField(verbose_name=_('Ano')) ano = models.PositiveSmallIntegerField(verbose_name=_('Ano'),
choices=RANGE_ANOS)
esfera_federacao = models.CharField( esfera_federacao = models.CharField(
max_length=1, max_length=1,
verbose_name=_('Esfera Federação'), verbose_name=_('Esfera Federação'),

2
parlamentares/models.py

@ -4,7 +4,7 @@ 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
from sapl.utils import YES_NO_CHOICES, UF from sapl.utils import UF, YES_NO_CHOICES
class Legislatura(models.Model): class Legislatura(models.Model):

11
protocoloadm/models.py

@ -5,7 +5,7 @@ from django.utils.translation import ugettext_lazy as _
from model_utils import Choices from model_utils import Choices
from materia.models import Autor, TipoMateriaLegislativa, UnidadeTramitacao from materia.models import Autor, TipoMateriaLegislativa, UnidadeTramitacao
from sapl.utils import YES_NO_CHOICES from sapl.utils import RANGE_ANOS, YES_NO_CHOICES
class TipoDocumentoAdministrativo(models.Model): class TipoDocumentoAdministrativo(models.Model):
@ -28,7 +28,8 @@ class DocumentoAdministrativo(models.Model):
tipo = models.ForeignKey( tipo = models.ForeignKey(
TipoDocumentoAdministrativo, verbose_name=_('Tipo Documento')) TipoDocumentoAdministrativo, verbose_name=_('Tipo Documento'))
numero = models.PositiveIntegerField(verbose_name=_('Número')) numero = models.PositiveIntegerField(verbose_name=_('Número'))
ano = models.PositiveSmallIntegerField(verbose_name=_('Ano')) ano = models.PositiveSmallIntegerField(verbose_name=_('Ano'),
choices=RANGE_ANOS)
data = models.DateField(verbose_name=_('Data')) data = models.DateField(verbose_name=_('Data'))
numero_protocolo = models.PositiveIntegerField( numero_protocolo = models.PositiveIntegerField(
blank=True, null=True, verbose_name=_('Núm. Protocolo')) blank=True, null=True, verbose_name=_('Núm. Protocolo'))
@ -89,8 +90,10 @@ class DocumentoAcessorioAdministrativo(models.Model):
class Protocolo(models.Model): class Protocolo(models.Model):
numero = models.PositiveIntegerField( numero = models.PositiveIntegerField(
blank=False, null=False, verbose_name=_('Número de Protocolo')) blank=False, null=False, verbose_name=_('Número de Protocolo'))
ano = models.PositiveSmallIntegerField( ano = models.PositiveSmallIntegerField(blank=False,
blank=False, null=False, verbose_name=_('Ano do Protocolo')) null=False,
choices=RANGE_ANOS,
verbose_name=_('Ano do Protocolo'))
data = models.DateField() data = models.DateField()
hora = models.TimeField() hora = models.TimeField()
timestamp = models.DateTimeField() timestamp = models.DateTimeField()

2
relatorios/views.py

@ -12,9 +12,7 @@ from parlamentares.models import (CargoMesa, ComposicaoMesa, Filiacao,
Parlamentar) Parlamentar)
from protocoloadm.models import (DocumentoAdministrativo, Protocolo, from protocoloadm.models import (DocumentoAdministrativo, Protocolo,
TramitacaoAdministrativo) TramitacaoAdministrativo)
from sapl.utils import UF from sapl.utils import UF
from sessao.models import (ExpedienteMateria, ExpedienteSessao, Orador, from sessao.models import (ExpedienteMateria, ExpedienteSessao, Orador,
OradorExpediente, OrdemDia, PresencaOrdemDia, OradorExpediente, OrdemDia, PresencaOrdemDia,
RegistroVotacao, SessaoPlenaria, RegistroVotacao, SessaoPlenaria,

3
sapl/utils.py

@ -1,3 +1,4 @@
from datetime import date
from functools import wraps from functools import wraps
from django.apps import apps from django.apps import apps
@ -95,3 +96,5 @@ UF = (
('TO', 'Tocantins'), ('TO', 'Tocantins'),
('EX', 'Exterior'), ('EX', 'Exterior'),
) )
RANGE_ANOS = [(year, year) for year in range(date.today().year, 1889, -1)]

Loading…
Cancel
Save