Browse Source

Coloca as 'choices' do formulario no models em Comissoes

pull/250/head
Eduardo Calil 9 years ago
committed by Marcio Mazza
parent
commit
88945249a6
  1. 21
      comissoes/forms.py
  2. 9
      comissoes/models.py

21
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,15 @@ class ParticipacaoCadastroForm(ModelForm):
'motivo_desligamento',
'observacao']
widgets = {
'data_designacao': forms.DateInput(format='%d/%m/%Y'),
'data_desligamento': forms.DateInput(format='%d/%m/%Y'),
}
input_formats = {
'data_designacao': ['%d/%m/%Y'],
'data_desligamento': ['%d/%m/%Y'],
}
def __init__(self, *args, **kwargs):
self.helper = FormHelper()

9
comissoes/models.py

@ -125,9 +125,12 @@ class Participacao(models.Model): # ComposicaoComissao
parlamentar = models.ForeignKey(Parlamentar)
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_designacao = models.DateField(blank=True,
null=True,
verbose_name=_('Data Designação'))
data_desligamento = models.DateField(blank=True,
null=True,
verbose_name=_('Data Desligamento'))
motivo_desligamento = models.CharField(
max_length=150,
blank=True,

Loading…
Cancel
Save