From cc998bc470af8b4049f4a6d5d30ca04128d07e6a Mon Sep 17 00:00:00 2001 From: Eduardo Calil Date: Thu, 7 Jan 2016 13:25:48 -0200 Subject: [PATCH] Fix obrigatory fields of SessaoPlenaria from TabelasAuxiliares --- base/migrations/0005_auto_20160107_1244.py | 39 ++++++++++++++++++++++ base/migrations/0006_auto_20160107_1257.py | 20 +++++++++++ base/models.py | 10 +++--- base/views.py | 9 ++--- 4 files changed, 69 insertions(+), 9 deletions(-) create mode 100644 base/migrations/0005_auto_20160107_1244.py create mode 100644 base/migrations/0006_auto_20160107_1257.py diff --git a/base/migrations/0005_auto_20160107_1244.py b/base/migrations/0005_auto_20160107_1244.py new file mode 100644 index 000000000..f3b06f338 --- /dev/null +++ b/base/migrations/0005_auto_20160107_1244.py @@ -0,0 +1,39 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('base', '0004_auto_20160107_1158'), + ] + + operations = [ + migrations.AlterField( + model_name='casalegislativa', + name='email', + field=models.CharField(max_length=100, null=True, verbose_name='E-mail', blank=True), + ), + migrations.AlterField( + model_name='casalegislativa', + name='endereco_web', + field=models.CharField(max_length=100, null=True, verbose_name='HomePage', blank=True), + ), + migrations.AlterField( + model_name='casalegislativa', + name='fax', + field=models.CharField(max_length=100, null=True, verbose_name='Fax', blank=True), + ), + migrations.AlterField( + model_name='casalegislativa', + name='informacao_geral', + field=models.CharField(max_length=100, null=True, verbose_name='Informação Geral', blank=True), + ), + migrations.AlterField( + model_name='casalegislativa', + name='telefone', + field=models.CharField(max_length=100, null=True, verbose_name='Telefone', blank=True), + ), + ] diff --git a/base/migrations/0006_auto_20160107_1257.py b/base/migrations/0006_auto_20160107_1257.py new file mode 100644 index 000000000..4f0e69522 --- /dev/null +++ b/base/migrations/0006_auto_20160107_1257.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('base', '0005_auto_20160107_1244'), + ] + + operations = [ + migrations.AlterField( + model_name='casalegislativa', + name='informacao_geral', + field=models.CharField(verbose_name='Informação Geral', max_length=100, default=1), + preserve_default=False, + ), + ] diff --git a/base/models.py b/base/models.py index 732183537..de8105776 100644 --- a/base/models.py +++ b/base/models.py @@ -20,17 +20,17 @@ class CasaLegislativa(models.Model): 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')) - telefone = models.CharField(max_length=100, verbose_name=_('Telefone')) - fax = models.CharField(max_length=100, verbose_name=_('Fax')) + telefone = models.CharField(max_length=100, blank=True, null=True, verbose_name=_('Telefone')) + fax = models.CharField(max_length=100, blank=True, null=True, verbose_name=_('Fax')) logotipo = models.FileField( blank=True, null=True, upload_to=get_casa_media_path, verbose_name=_('Logotipo')) - endereco_web = models.CharField(max_length=100, verbose_name=_('HomePage')) - email = models.CharField(max_length=100, verbose_name=_('E-mail')) + endereco_web = models.CharField(max_length=100, blank=True, null=True, verbose_name=_('HomePage')) + email = models.CharField(max_length=100, blank=True, null=True, verbose_name=_('E-mail')) informacao_geral = models.CharField( - max_length=100, verbose_name=_('Informação Geral')) + max_length=100, blank=True, null=True, verbose_name=_('Informação Geral')) class Meta: verbose_name = _('Casa Legislativa') diff --git a/base/views.py b/base/views.py index 52054ee9c..5f3750861 100644 --- a/base/views.py +++ b/base/views.py @@ -51,15 +51,16 @@ ESTADOS = ["AC", class CasaLegislativaTabelaAuxForm(ModelForm): - uf = forms.ChoiceField(required=False, + uf = forms.ChoiceField(required=True, label='UF', choices=[(a, a) for a in ESTADOS], widget=forms.Select( attrs={'class': 'selector'})) - informacao_geral = forms.CharField(widget=forms.Textarea, - label='informacao_geral', - required=True) + + informacao_geral = forms.CharField(widget=forms.Textarea, + label='Informação Geral', + required=False) telefone = forms.CharField(label='Telefone', required=True,