diff --git a/base/forms.py b/base/forms.py index c0905a944..0c80ec947 100644 --- a/base/forms.py +++ b/base/forms.py @@ -9,68 +9,9 @@ from crispy_layout_mixin import form_actions from .models import CasaLegislativa -ESTADOS = {"": "", - "AC": "ACRE", - "AL": "ALAGOAS", - "AM": "AMAZONAS", - "AP": "AMAPÁ", - "BA": "BAHIA", - "CE": "CEARÁ", - "DF": "DISTRITO FEDERAL", - "ES": "ESPíRITO SANTO", - "GO": "GOIÁS", - "MA": "MARANHÃO", - "MG": "MINAS GERAIS", - "MS": "MATO GROSSO DO SUL", - "MT": "MATO GROSSO", - "PA": "PARÁ", - "PB": "PARAÍBA", - "PE": "PERNAMBUCO", - "PI": "PIAUÍ", - "PR": "PARANÁ", - "RJ": "RIO DE JANEIRO", - "RN": "RIO GRANDE DO NORTE", - "RO": "RONDÔNIA", - "RR": "RORAIMA", - "RS": "RIO GRANDE DO SUL", - "SC": "SANTA CATARINA", - "SE": "SERGIPE", - "SP": "SÃO PAULO", - "TO": "TOCANTINS"} - class CasaLegislativaTabelaAuxForm(ModelForm): - uf = forms.ChoiceField(required=True, - label='UF', - choices=[(uf, uf) for uf in ESTADOS.keys()], - widget=forms.Select( - attrs={'class': 'selector'})) - - informacao_geral = forms.CharField(widget=forms.Textarea, - label=_('Informação Geral'), - required=False) - - telefone = forms.CharField(label='Telefone', - required=False, - widget=forms.TextInput( - attrs={'class': 'telefone'})) - - logotipo = forms.ImageField(label='Logotipo', - required=False, - widget=forms.FileInput - ) - - cep = forms.CharField(label='Cep', - required=True, - widget=forms.TextInput( - attrs={'class': 'cep'})) - - fax = forms.CharField(label='Fax', - required=False, - widget=forms.TextInput( - attrs={'class': 'telefone'})) - class Meta: model = CasaLegislativa @@ -88,6 +29,13 @@ class CasaLegislativaTabelaAuxForm(ModelForm): 'email', 'informacao_geral'] + widgets = { + 'uf': forms.Select(attrs={'class': 'selector'}), + 'cep': forms.TextInput(attrs={'class': 'cep'}), + 'telefone': forms.TextInput(attrs={'class': 'telefone'}), + 'fax': forms.TextInput(attrs={'class': 'telefone'}), + } + def __init__(self, *args, **kwargs): row1 = crispy_layout_mixin.to_row( diff --git a/base/migrations/0010_auto_20160309_1323.py b/base/migrations/0010_auto_20160309_1323.py new file mode 100644 index 000000000..d0caee056 --- /dev/null +++ b/base/migrations/0010_auto_20160309_1323.py @@ -0,0 +1,25 @@ +# -*- 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 = [ + ('base', '0009_auto_20160307_0905'), + ] + + operations = [ + migrations.AlterField( + model_name='casalegislativa', + name='informacao_geral', + field=models.TextField(blank=True, max_length=100, verbose_name='Informação Geral'), + ), + migrations.AlterField( + model_name='casalegislativa', + name='uf', + field=models.CharField(choices=[('AC', 'Acre'), ('AL', 'Alagoas'), ('AP', 'Amapá'), ('AM', 'Amazonas'), ('BA', 'Bahia'), ('CE', 'Ceará'), ('DF', 'Distrito Federal'), ('ES', 'Espírito Santo'), ('GO', 'Goiás'), ('MA', 'Maranhão'), ('MT', 'Mato Grosso'), ('MS', 'Mato Grosso do Sul'), ('MG', 'Minas Gerais'), ('PR', 'Paraná'), ('PB', 'Paraíba'), ('PA', 'Pará'), ('PE', 'Pernambuco'), ('PI', 'Piauí'), ('RJ', 'Rio de Janeiro'), ('RN', 'Rio Grande do Norte'), ('RS', 'Rio Grande do Sul'), ('RO', 'Rondônia'), ('RR', 'Roraima'), ('SC', 'Santa Catarina'), ('SE', 'Sergipe'), ('SP', 'São Paulo'), ('TO', 'Tocantins'), ('EX', 'Exterior')], max_length=100, verbose_name='UF'), + ), + ] diff --git a/base/models.py b/base/models.py index 9080d75e0..e2f1cddf6 100644 --- a/base/models.py +++ b/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 def get_sessao_media_path(instance, subpath, filename): @@ -20,7 +21,9 @@ class CasaLegislativa(models.Model): endereco = models.CharField(max_length=100, verbose_name=_('Endereço')) cep = models.CharField(max_length=100, verbose_name=_('CEP')) municipio = models.CharField(max_length=100, verbose_name=_('Município')) - uf = models.CharField(max_length=100, verbose_name=_('UF')) + uf = models.CharField(max_length=100, + choices=UF, + verbose_name=_('UF')) telefone = models.CharField( max_length=100, blank=True, verbose_name=_('Telefone')) fax = models.CharField( @@ -33,7 +36,7 @@ class CasaLegislativa(models.Model): max_length=100, blank=True, verbose_name=_('HomePage')) email = models.EmailField( max_length=100, blank=True, verbose_name=_('E-mail')) - informacao_geral = models.CharField( + informacao_geral = models.TextField( max_length=100, blank=True, verbose_name=_('Informação Geral')) diff --git a/comissoes/forms.py b/comissoes/forms.py index 55ca1d2d9..0843643d7 100644 --- a/comissoes/forms.py +++ b/comissoes/forms.py @@ -124,18 +124,6 @@ class ParticipacaoCadastroForm(ModelForm): empty_label='Selecione', ) - data_designacao = forms.DateField(label=u'Data Designação', - input_formats=['%d/%m/%Y'], - required=True, - widget=forms.DateInput( - format='%d/%m/%Y')) - - data_desligamento = forms.DateField(label=u'Data Desligamento', - input_formats=['%d/%m/%Y'], - required=False, - widget=forms.DateInput( - format='%d/%m/%Y')) - class Meta: model = Participacao fields = ['parlamentar_id', @@ -146,6 +134,11 @@ class ParticipacaoCadastroForm(ModelForm): 'motivo_desligamento', 'observacao'] + widgets = { + 'data_designacao': forms.DateInput(format='%d/%m/%Y'), + 'data_desligamento': forms.DateInput(format='%d/%m/%Y'), + } + def __init__(self, *args, **kwargs): self.helper = FormHelper() diff --git a/comissoes/models.py b/comissoes/models.py index 6e41e0e01..24c476c44 100644 --- a/comissoes/models.py +++ b/comissoes/models.py @@ -126,8 +126,9 @@ class Participacao(models.Model): # ComposicaoComissao cargo = models.ForeignKey(CargoComissao) titular = models.BooleanField(verbose_name=_('Titular')) data_designacao = models.DateField(verbose_name=_('Data Designação')) - data_desligamento = models.DateField( - blank=True, null=True, verbose_name=_('Data Desligamento')) + data_desligamento = models.DateField(blank=True, + null=True, + verbose_name=_('Data Desligamento')) motivo_desligamento = models.CharField( max_length=150, blank=True, diff --git a/comissoes/views.py b/comissoes/views.py index 46e57aa85..0da73e5f7 100644 --- a/comissoes/views.py +++ b/comissoes/views.py @@ -136,9 +136,11 @@ class ComissaoParlamentarEditView(FormMixin, GenericView): participacao_id = kwargs['id'] participacao = Participacao.objects.get(id=participacao_id) comissao = Comissao.objects.get(id=self.kwargs['pk']) + id_parlamentar = Filiacao.objects.filter( + parlamentar__id=participacao.parlamentar.id).order_by('data') + id_parlamentar = id_parlamentar.last().id form = ParticipacaoCadastroForm( - initial={'parlamentar_id': (Filiacao.objects.get( - parlamentar__id=participacao.parlamentar.id).id)}, + initial={'parlamentar_id': id_parlamentar}, instance=participacao) return self.render_to_response({'form': form, 'comissao': comissao, diff --git a/materia/forms.py b/materia/forms.py index 154aa107f..9c6112d55 100644 --- a/materia/forms.py +++ b/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, Submit +from crispy_forms.layout import Column, Fieldset, Layout from django import forms from django.forms import ModelForm from django.utils.safestring import mark_safe @@ -54,9 +54,6 @@ class HorizontalRadioRenderer(forms.RadioSelect.renderer): class ProposicaoForm(ModelForm): - descricao = forms.CharField( - label='Descrição', required=True, - widget=forms.Textarea()) tipo_materia = forms.ModelChoiceField( label=_('Matéria Vinculada'), @@ -143,12 +140,6 @@ class DocumentoAcessorioForm(ModelForm): empty_label='Selecione', ) - data = forms.DateField(label='Data', - required=False, - input_formats=['%d/%m/%Y'], - widget=forms.TextInput( - attrs={'class': 'dateinput'})) - nome = forms.CharField( label='Nome', required=True) @@ -165,6 +156,9 @@ class DocumentoAcessorioForm(ModelForm): 'data', 'autor', 'ementa'] + widgets = { + 'data': forms.DateInput(attrs={'class': 'dateinput'}) + } def __init__(self, *args, **kwargs): @@ -191,21 +185,6 @@ class DocumentoAcessorioForm(ModelForm): class RelatoriaForm(ModelForm): - data_designacao_relator = forms.DateField( - label=u'Data Designação', - input_formats=['%d/%m/%Y'], - required=False, - widget=forms.DateInput( - format='%d/%m/%Y', - attrs={'class': 'dateinput'})) - - data_destituicao_relator = forms.DateField( - label=u'Data Destituição', - input_formats=['%d/%m/%Y'], - required=False, - widget=forms.DateInput( - format='%d/%m/%Y', - attrs={'class': 'dateinput'})) class Meta: model = Relatoria @@ -215,31 +194,16 @@ class RelatoriaForm(ModelForm): 'data_destituicao_relator', 'tipo_fim_relatoria' ] + widgets = { + 'data_designacao_relator': forms.DateInput(attrs={ + 'class': 'dateinput'}), + 'data_destituicao_relator': forms.DateInput(attrs={ + 'class': 'dateinput'}), + } class TramitacaoForm(ModelForm): - data_tramitacao = forms.DateField(label=u'Data Tramitação', - input_formats=['%d/%m/%Y'], - required=False, - widget=forms.DateInput( - format='%d/%m/%Y', - attrs={'class': 'dateinput'})) - - data_encaminhamento = forms.DateField(label=u'Data Encaminhamento', - input_formats=['%d/%m/%Y'], - required=False, - widget=forms.DateInput( - format='%d/%m/%Y', - attrs={'class': 'dateinput'})) - - data_fim_prazo = forms.DateField(label=u'Data Fim Prazo', - input_formats=['%d/%m/%Y'], - required=False, - widget=forms.DateInput( - format='%d/%m/%Y', - attrs={'class': 'dateinput'})) - class Meta: model = Tramitacao fields = ['data_tramitacao', @@ -252,6 +216,15 @@ class TramitacaoForm(ModelForm): 'data_fim_prazo', 'texto'] + widgets = { + 'data_tramitacao': forms.DateInput(attrs={ + 'class': 'dateinput'}), + 'data_encaminhamento': forms.DateInput(attrs={ + 'class': 'dateinput'}), + 'data_fim_prazo': forms.DateInput(attrs={ + 'class': 'dateinput'}), + } + def __init__(self, *args, **kwargs): row1 = crispy_layout_mixin.to_row( [('data_tramitacao', 6), @@ -384,21 +357,6 @@ class NumeracaoForm(ModelForm): empty_label='Selecione', ) - data_materia = forms.DateField(label='Data', - required=True, - input_formats=['%d/%m/%Y'], - widget=forms.TextInput( - attrs={'class': 'dateinput'})) - - ano_materia = forms.ChoiceField(required=True, - label='Ano', - choices=get_range_anos(), - widget=forms.Select( - attrs={'class': 'selector'})) - - numero_materia = forms.CharField( - label='Número', required=True) - class Meta: model = Numeracao fields = ['tipo_materia', @@ -406,6 +364,11 @@ class NumeracaoForm(ModelForm): 'ano_materia', 'data_materia'] + widgets = { + 'data_materia': forms.DateInput(attrs={'class': 'dateinput'}), + 'ano_materia': forms.Select(attrs={'class': 'selector'}), + } + def __init__(self, *args, **kwargs): row1 = crispy_layout_mixin.to_row( @@ -437,7 +400,6 @@ class DespachoInicialForm(ModelForm): more = [] if excluir: more = [Submit('Excluir', 'Excluir')] - self.helper = FormHelper() self.helper.layout = Layout( Fieldset( @@ -466,6 +428,10 @@ class MateriaAnexadaForm(ModelForm): model = Anexada fields = ['tipo', 'numero', 'ano', 'data_anexacao', 'data_desanexacao'] + widgets = { + 'data_anexacao': forms.DateInput(attrs={'class': 'dateinput'}), + 'data_desanexacao': forms.DateInput(attrs={'class': 'dateinput'}), + } def __init__(self, excluir=False, *args, **kwargs): @@ -492,12 +458,6 @@ class MateriaAnexadaForm(ModelForm): class FormularioSimplificadoForm(ModelForm): - data_apresentacao = forms.DateField(label=u'Data Apresentação', - input_formats=['%d/%m/%Y'], - required=False, - widget=forms.DateInput( - format='%d/%m/%Y')) - class Meta: model = MateriaLegislativa fields = ['tipo', @@ -510,6 +470,9 @@ class FormularioSimplificadoForm(ModelForm): 'ementa', 'texto_original'] exclude = ['anexadas'] + widgets = { + 'data_apresentacao': forms.DateInput(attrs={'class': 'dateinput'}), + } def __init__(self, *args, **kwargs): diff --git a/materia/migrations/0022_auto_20160309_1323.py b/materia/migrations/0022_auto_20160309_1323.py new file mode 100644 index 000000000..23c874dc1 --- /dev/null +++ b/materia/migrations/0022_auto_20160309_1323.py @@ -0,0 +1,25 @@ +# -*- 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 = [ + ('materia', '0021_auto_20160307_0905'), + ] + + operations = [ + migrations.AlterField( + model_name='numeracao', + name='ano_materia', + 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='proposicao', + name='descricao', + field=models.TextField(max_length=100, verbose_name='Descrição'), + ), + ] diff --git a/materia/models.py b/materia/models.py index 5da4beb89..bf3fabd0e 100644 --- a/materia/models.py +++ b/materia/models.py @@ -1,3 +1,5 @@ +from datetime import date + from django.db import models from django.utils.translation import ugettext_lazy as _ from model_utils import Choices @@ -300,12 +302,17 @@ 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( TipoMateriaLegislativa, verbose_name=_('Tipo de Matéria')) - numero_materia = models.CharField(max_length=5, verbose_name=_('Número')) - ano_materia = models.PositiveSmallIntegerField(verbose_name=_('Ano')) + numero_materia = models.CharField(max_length=5, + verbose_name=_('Número')) + ano_materia = models.PositiveSmallIntegerField(verbose_name=_('Ano'), + choices=RANGE_ANOS) data_materia = models.DateField( blank=True, verbose_name=_('Data')) @@ -430,7 +437,7 @@ class Proposicao(models.Model): null=True, verbose_name=_('Data de Envio')) data_recebimento = models.DateTimeField( blank=True, null=True, verbose_name=_('Data de Incorporação')) - descricao = models.CharField(max_length=100, verbose_name=_('Descrição')) + descricao = models.TextField(max_length=100, verbose_name=_('Descrição')) data_devolucao = models.DateTimeField( blank=True, null=True, verbose_name=_('Data de devolução')) justificativa_devolucao = models.CharField( diff --git a/parlamentares/forms.py b/parlamentares/forms.py index b5b496633..0f016668c 100644 --- a/parlamentares/forms.py +++ b/parlamentares/forms.py @@ -30,51 +30,6 @@ class ParlamentaresForm (ModelForm): ) ) - cpf = forms.CharField(label='C.P.F', - required=False, - widget=forms.TextInput( - attrs={'class': 'cpf'})) - - rg = forms.CharField(label='R.G.', - required=False, - widget=forms.TextInput( - attrs={'class': 'rg'})) - - titulo_eleitor = forms.CharField(label=_('Título de Eleitor'), - required=False, - widget=forms.TextInput( - attrs={'class': 'titulo_eleitor'})) - - telefone = forms.CharField(label='Telefone', - required=False, - widget=forms.TextInput( - attrs={'class': 'telefone'})) - - fax = forms.CharField(label='Fax', - required=False, - widget=forms.TextInput( - attrs={'class': 'telefone'})) - - cep_residencia = forms.CharField(label='CEP', - required=False, - widget=forms.TextInput( - attrs={'class': 'cep'})) - - telefone_residencia = forms.CharField(label='Telefone', - required=False, - widget=forms.TextInput( - attrs={'class': 'telefone'})) - - fax_residencia = forms.CharField(label='Fax', - required=False, - widget=forms.TextInput( - attrs={'class': 'telefone'})) - - fotografia = forms.ImageField(label='Fotografia', - required=False, - widget=forms.FileInput - ) - class Meta: model = Parlamentar fields = ['nome_parlamentar', @@ -102,6 +57,20 @@ class ParlamentaresForm (ModelForm): 'fotografia', 'biografia'] + widgets = { + 'cpf': forms.TextInput(attrs={'class': 'cpf'}), + 'rg': forms.TextInput(attrs={'class': 'rg'}), + 'titulo_eleitor': forms.TextInput(attrs={ + 'class': 'titulo_eleitor'}), + 'telefone': forms.TextInput(attrs={'class': 'telefone'}), + 'fax': forms.TextInput(attrs={'class': 'telefone'}), + 'cep_residencia': forms.TextInput(attrs={'class': 'cep'}), + 'telefone_residencia': forms.TextInput(attrs={ + 'class': 'telefone'}), + 'fax_residencia': forms.TextInput(attrs={'class': 'telefone'}), + 'fotografia': forms.FileInput + } + def __init__(self, *args, **kwargs): row1 = crispy_layout_mixin.to_row( diff --git a/parlamentares/models.py b/parlamentares/models.py index 910d47f25..ac31e0133 100644 --- a/parlamentares/models.py +++ b/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 +from sapl.utils import YES_NO_CHOICES, UF class Legislatura(models.Model): @@ -119,40 +119,9 @@ class Municipio(models.Model): # Localidade ('EX', 'Exterior'), ) - UF_CHOICES = ( - ('AC', 'Acre'), - ('AL', 'Alagoas'), - ('AP', 'Amapá'), - ('AM', 'Amazonas'), - ('BA', 'Bahia'), - ('CE', 'Ceará'), - ('DF', 'Distrito Federal'), - ('ES', 'Espírito Santo'), - ('GO', 'Goiás'), - ('MA', 'Maranhão'), - ('MT', 'Mato Grosso'), - ('MS', 'Mato Grosso do Sul'), - ('MG', 'Minas Gerais'), - ('PR', 'Paraná'), - ('PB', 'Paraíba'), - ('PA', 'Pará'), - ('PE', 'Pernambuco'), - ('PI', 'Piauí'), - ('RJ', 'Rio de Janeiro'), - ('RN', 'Rio Grande do Norte'), - ('RS', 'Rio Grande do Sul'), - ('RO', 'Rondônia'), - ('RR', 'Roraima'), - ('SC', 'Santa Catarina'), - ('SE', 'Sergipe'), - ('SP', 'São Paulo'), - ('TO', 'Tocantins'), - ('EX', 'Exterior'), - ) - nome = models.CharField(max_length=50, blank=True) uf = models.CharField( - max_length=2, blank=True, choices=UF_CHOICES) + max_length=2, blank=True, choices=UF) regiao = models.CharField( max_length=2, blank=True, choices=REGIAO_CHOICES) diff --git a/protocoloadm/forms.py b/protocoloadm/forms.py index fd1a9dc16..338e48e82 100644 --- a/protocoloadm/forms.py +++ b/protocoloadm/forms.py @@ -400,10 +400,6 @@ class ProposicaoSimpleForm(forms.Form): class DocumentoAcessorioAdministrativoForm(ModelForm): - data = forms.DateField(label=u'Data', input_formats=['%d/%m/%Y'], - required=False, - widget=forms.DateInput(format='%d/%m/%Y')) - class Meta: model = DocumentoAcessorioAdministrativo fields = ['tipo', @@ -413,6 +409,10 @@ class DocumentoAcessorioAdministrativoForm(ModelForm): 'arquivo', 'assunto'] + widgets = { + 'data': forms.DateInput(format='%d/%m/%Y') + } + def __init__(self, excluir=False, *args, **kwargs): row1 = crispy_layout_mixin.to_row( @@ -444,27 +444,6 @@ class DocumentoAcessorioAdministrativoForm(ModelForm): class TramitacaoAdmForm(ModelForm): - data_tramitacao = forms.DateField(label=u'Data Tramitação', - input_formats=['%d/%m/%Y'], - required=False, - widget=forms.DateInput( - format='%d/%m/%Y', - attrs={'class': 'dateinput'})) - - data_encaminhamento = forms.DateField(label=u'Data Encaminhamento', - input_formats=['%d/%m/%Y'], - required=False, - widget=forms.DateInput( - format='%d/%m/%Y', - attrs={'class': 'dateinput'})) - - data_fim_prazo = forms.DateField(label=u'Data Fim Prazo', - input_formats=['%d/%m/%Y'], - required=False, - widget=forms.DateInput( - format='%d/%m/%Y', - attrs={'class': 'dateinput'})) - class Meta: model = TramitacaoAdministrativo fields = ['data_tramitacao', @@ -477,6 +456,12 @@ class TramitacaoAdmForm(ModelForm): 'documento', ] + widgets = { + 'data_tramitacao': forms.DateInput(format='%d/%m/%Y'), + 'data_encaminhamento': forms.DateInput(format='%d/%m/%Y'), + 'data_fim_prazo': forms.DateInput(format='%d/%m/%Y'), + } + def __init__(self, *args, **kwargs): self.helper = FormHelper() self.helper.layout = Layout( diff --git a/protocoloadm/migrations/0009_auto_20160309_1323.py b/protocoloadm/migrations/0009_auto_20160309_1323.py new file mode 100644 index 000000000..aa7760eca --- /dev/null +++ b/protocoloadm/migrations/0009_auto_20160309_1323.py @@ -0,0 +1,20 @@ +# -*- 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'), + ), + ] diff --git a/relatorios/views.py b/relatorios/views.py index 6a79732aa..fef8bb19f 100644 --- a/relatorios/views.py +++ b/relatorios/views.py @@ -4,7 +4,6 @@ from bs4 import BeautifulSoup from django.http import HttpResponse from django.utils.translation import ugettext_lazy as _ -from base.forms import ESTADOS from base.models import CasaLegislativa from comissoes.models import Comissao from materia.models import (Autor, Autoria, MateriaLegislativa, Numeracao, @@ -13,6 +12,9 @@ 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, @@ -42,7 +44,7 @@ def get_cabecalho(casa): cabecalho = {} cabecalho["nom_casa"] = casa.nome # FIXME i18n - cabecalho["nom_estado"] = "Estado de " + ESTADOS[casa.uf.upper()] + cabecalho["nom_estado"] = "Estado de " + UF[casa.uf.upper()] return cabecalho diff --git a/sapl/utils.py b/sapl/utils.py index ce166c4f0..189372479 100644 --- a/sapl/utils.py +++ b/sapl/utils.py @@ -64,3 +64,34 @@ def listify(function): def f(*args, **kwargs): return list(function(*args, **kwargs)) return f + +UF = ( + ('AC', 'Acre'), + ('AL', 'Alagoas'), + ('AP', 'Amapá'), + ('AM', 'Amazonas'), + ('BA', 'Bahia'), + ('CE', 'Ceará'), + ('DF', 'Distrito Federal'), + ('ES', 'Espírito Santo'), + ('GO', 'Goiás'), + ('MA', 'Maranhão'), + ('MT', 'Mato Grosso'), + ('MS', 'Mato Grosso do Sul'), + ('MG', 'Minas Gerais'), + ('PR', 'Paraná'), + ('PB', 'Paraíba'), + ('PA', 'Pará'), + ('PE', 'Pernambuco'), + ('PI', 'Piauí'), + ('RJ', 'Rio de Janeiro'), + ('RN', 'Rio Grande do Norte'), + ('RS', 'Rio Grande do Sul'), + ('RO', 'Rondônia'), + ('RR', 'Roraima'), + ('SC', 'Santa Catarina'), + ('SE', 'Sergipe'), + ('SP', 'São Paulo'), + ('TO', 'Tocantins'), + ('EX', 'Exterior'), + ) diff --git a/sessao/forms.py b/sessao/forms.py index 253f533d9..4b2367e52 100644 --- a/sessao/forms.py +++ b/sessao/forms.py @@ -70,16 +70,6 @@ class VotacaoEditForm(forms.Form): class SessaoForm(ModelForm): - hora_inicio = forms.CharField(label=_('Horário Inicio'), - required=True, - widget=forms.TextInput( - attrs={'class': 'hora'})) - - hora_fim = forms.CharField(label=_('Horário Fim'), - required=True, - widget=forms.TextInput( - attrs={'class': 'hora'})) - class Meta: model = SessaoPlenaria fields = ['numero', @@ -97,6 +87,11 @@ class SessaoForm(ModelForm): 'url_audio', 'url_video'] + widgets = { + 'hora_inicio': forms.TextInput(attrs={'class': 'hora'}), + 'hora_fim': forms.TextInput(attrs={'class': 'hora'}), + } + def __init__(self, *args, **kwargs): row1 = crispy_layout_mixin.to_row(