diff --git a/sigi/apps/servicos/models.py b/sigi/apps/servicos/models.py index 9f4bcce..7a98238 100644 --- a/sigi/apps/servicos/models.py +++ b/sigi/apps/servicos/models.py @@ -183,8 +183,9 @@ class CasaManifesta(models.Model): casa_legislativa = models.OneToOneField(CasaLegislativa) data_manifestacao = models.DateTimeField(auto_now_add=True) data_atualizacao = models.DateTimeField(auto_now=True) - informante = models.CharField(u'Nome do informante', max_length=100) - cargo = models.CharField(u'Cargo do informante', max_length=100) + informante = models.CharField(u'Nome do informante', max_length=100, blank=True) + cargo = models.CharField(u'Cargo do informante', max_length=100, blank=True) + email = models.EmailField(u'E-mail de contato', blank=True) class ServicoManifesto(models.Model): casa_manifesta = models.ForeignKey(CasaManifesta) diff --git a/sigi/apps/servicos/views.py b/sigi/apps/servicos/views.py index 0e61541..5388462 100644 --- a/sigi/apps/servicos/views.py +++ b/sigi/apps/servicos/views.py @@ -41,6 +41,7 @@ class CasaManifestaProtoForm(forms.Form): fieldsets = None informante = forms.CharField(max_length=100, required=False) cargo = forms.CharField(max_length=100, required=False) + email = forms.EmailField(required=False) def set_fieldsets(self, fieldsets): result = [] @@ -66,7 +67,7 @@ def casa_manifesta_view(request): # Criar um formulário dinâmico campos = {} - fieldsets = ((None, ('informante', 'cargo'),),) + fieldsets = ((None, ('informante', 'cargo', 'email'),),) for ts in TipoServico.objects.all(): campos['possui_%s' % ts.pk] = forms.BooleanField(label=u'Possui o serviço de %s' % ts.nome, required=False) @@ -83,9 +84,11 @@ def casa_manifesta_view(request): cm, created = CasaManifesta.objects.get_or_create(casa_legislativa=casa) cm.informante = cmf.cleaned_data['informante'] cm.cargo = cmf.cleaned_data['cargo'] + cm.email = cmf.cleaned_data['email'] cm.save() thanks.append((u'Informante', cmf.cleaned_data['informante'])) thanks.append((u'Cargo', cmf.cleaned_data['cargo'])) + thanks.append((u'E-mail', cmf.cleaned_data['email'])) for ts in TipoServico.objects.all(): if cmf.cleaned_data['possui_%s' % ts.pk]: sm, created = ServicoManifesto.objects.get_or_create(casa_manifesta=cm, servico=ts) @@ -106,6 +109,7 @@ def casa_manifesta_view(request): values = { 'informante': cm.informante, 'cargo': cm.cargo, + 'email': cm.email, } for sm in cm.servicomanifesto_set.all(): values['possui_%s' % sm.servico.pk] = True diff --git a/sigi/templates/servicos/casa_manifesta.html b/sigi/templates/servicos/casa_manifesta.html index c0fbea5..55e945c 100644 --- a/sigi/templates/servicos/casa_manifesta.html +++ b/sigi/templates/servicos/casa_manifesta.html @@ -61,33 +61,6 @@