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.utils.translation import ugettext_lazy as _
from sapl.utils import UF

3
materia/forms.py

@ -1,7 +1,7 @@
from datetime import date
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.forms import ModelForm
from django.utils.safestring import mark_safe
@ -54,7 +54,6 @@ class HorizontalRadioRenderer(forms.RadioSelect.renderer):
class ProposicaoForm(ModelForm):
tipo_materia = forms.ModelChoiceField(
label=_('Matéria Vinculada'),
required=False,

12
materia/models.py

@ -1,12 +1,10 @@
from datetime import date
from django.db import models
from django.utils.translation import ugettext_lazy as _
from model_utils import Choices
from comissoes.models import Comissao
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):
@ -64,7 +62,8 @@ class MateriaLegislativa(models.Model):
tipo = models.ForeignKey(TipoMateriaLegislativa, verbose_name=_('Tipo'))
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(
blank=True, null=True, verbose_name=_('Núm. Protocolo'))
data_apresentacao = models.DateField(verbose_name=_('Data Apresentação'))
@ -85,7 +84,7 @@ class MateriaLegislativa(models.Model):
numero_origem_externa = models.CharField(
max_length=5, blank=True, verbose_name=_('Número'))
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(
blank=True, null=True, verbose_name=_('Data'))
local_origem_externa = models.ForeignKey(
@ -302,9 +301,6 @@ class MateriaAssunto(models.Model):
'materia': self.materia, 'assunto': self.assunto}
RANGE_ANOS = [(year, year) for year in range(date.today().year, 1889, -1)]
class Numeracao(models.Model):
materia = models.ForeignKey(MateriaLegislativa)
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 materia.models import MateriaLegislativa
from sapl.utils import YES_NO_CHOICES
from sapl.utils import RANGE_ANOS, YES_NO_CHOICES
class AssuntoNorma(models.Model):
@ -76,7 +76,8 @@ class NormaJuridica(models.Model):
TipoNormaJuridica, verbose_name=_('Tipo da Norma Juridica'))
materia = models.ForeignKey(MateriaLegislativa, blank=True, null=True)
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(
max_length=1,
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 model_utils import Choices
from sapl.utils import YES_NO_CHOICES, UF
from sapl.utils import UF, YES_NO_CHOICES
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 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):
@ -28,7 +28,8 @@ class DocumentoAdministrativo(models.Model):
tipo = models.ForeignKey(
TipoDocumentoAdministrativo, verbose_name=_('Tipo Documento'))
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'))
numero_protocolo = models.PositiveIntegerField(
blank=True, null=True, verbose_name=_('Núm. Protocolo'))
@ -89,8 +90,10 @@ class DocumentoAcessorioAdministrativo(models.Model):
class Protocolo(models.Model):
numero = models.PositiveIntegerField(
blank=False, null=False, verbose_name=_('Número de Protocolo'))
ano = models.PositiveSmallIntegerField(
blank=False, null=False, verbose_name=_('Ano do Protocolo'))
ano = models.PositiveSmallIntegerField(blank=False,
null=False,
choices=RANGE_ANOS,
verbose_name=_('Ano do Protocolo'))
data = models.DateField()
hora = models.TimeField()
timestamp = models.DateTimeField()

2
relatorios/views.py

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

3
sapl/utils.py

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

Loading…
Cancel
Save