From 303ecf373bec7b30fedbcf366fd528713cefff25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ses=C3=B3stris=20Vieira?= Date: Thu, 31 Oct 2013 18:14:03 -0200 Subject: [PATCH] =?UTF-8?q?Acrescentado=20e-mail=20no=20formul=C3=A1rio=20?= =?UTF-8?q?de=20manifesta=C3=A7=C3=A3o=20das=20Casas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sigi/apps/servicos/models.py | 5 ++-- sigi/apps/servicos/views.py | 6 ++++- sigi/templates/servicos/casa_manifesta.html | 27 --------------------- 3 files changed, 8 insertions(+), 30 deletions(-) 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 @@

3. Informe os dados para a {{ casa.nome }} - {{ casa.municipio.uf }}

{% csrf_token %} {% for fieldset in cmf.fieldsets %} - {% comment %} -
- {% if fieldset.name %}

{{ fieldset.name }}

{% endif %} - {% for line in fieldset.lines %} -
- {% for field in line %} -
- {% if not field.is_readonly %}{{ field.errors }}{% endif %} - {% if field.is_checkbox %} - {{ field }}{{ field.label_tag }} - {% else %} - {{ field.label_tag }} - {% if field.is_readonly %} -

{{ field.contents }}

- {% else %} - {{ field }} - {% endif %} - {% endif %} - {% if field.field.help_text %} -

{{ field.field.help_text|safe }}

- {% endif %} -
- {% endfor %} -
- {% endfor %} -
- {% endcomment %} {% if forloop.first %}
{% if fieldset.name %}

{{ fieldset.name }}

{% endif %}