|
|
@ -1004,7 +1004,7 @@ class RelatoriaView(FormMixin, GenericView): |
|
|
'parlamentares': parlamentares}) |
|
|
'parlamentares': parlamentares}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def criar_corpo(materia, hash_txt): |
|
|
def criar_html_email(materia, hash_txt): |
|
|
|
|
|
|
|
|
header_tpl = Template(''' |
|
|
header_tpl = Template(''' |
|
|
<html> |
|
|
<html> |
|
|
@ -1025,22 +1025,24 @@ def criar_corpo(materia, hash_txt): |
|
|
$data_registro |
|
|
$data_registro |
|
|
</p> |
|
|
</p> |
|
|
<h4> |
|
|
<h4> |
|
|
<a href='"+context.consultas.absolute_url()+ |
|
|
<a href='context.consultas.absolute_url() |
|
|
"/materia/materia_mostrar_proc?cod_materia= |
|
|
/materia/materia_mostrar_proc?cod_materia= |
|
|
$cod_materia'><b>{{descricao_materia}}</b></a> |
|
|
$cod_materia'><b>$descricao_materia</b></a> |
|
|
<br/><br/> |
|
|
<br/><br/> |
|
|
''') |
|
|
''') |
|
|
casa = CasaLegislativa.objects.first() |
|
|
casa = CasaLegislativa.objects.first() |
|
|
header = header_tpl.substitute(image=static('img/logo.png'), |
|
|
header = header_tpl.substitute(image=static('img/logo.png'), |
|
|
casa_legislativa=casa, |
|
|
casa_legislativa=casa.nome + ' de ' +\ |
|
|
data_registro=datetime.now(), |
|
|
casa.municipio + '-' + \ |
|
|
|
|
|
casa.uf, |
|
|
|
|
|
data_registro=datetime.now().strftime("%d/%m/%Y"), |
|
|
cod_materia=materia.id, |
|
|
cod_materia=materia.id, |
|
|
descricao_materia=materia.ementa) |
|
|
descricao_materia=materia.ementa) |
|
|
|
|
|
|
|
|
autoria = "<b>Autoria: </b>" |
|
|
autoria_html = "<b>Autoria: </b>" |
|
|
|
|
|
|
|
|
for autor in materia.autoria_set.all(): |
|
|
for autoria in materia.autoria_set.all(): |
|
|
autoria += autor.nom_autor + "<br/> " |
|
|
autoria_html += autoria.autor.nome + "<br/> " |
|
|
|
|
|
|
|
|
footer_tpl = Template(''' |
|
|
footer_tpl = Template(''' |
|
|
</h4> |
|
|
</h4> |
|
|
@ -1052,7 +1054,7 @@ def criar_corpo(materia, hash_txt): |
|
|
$texto_acao</p> |
|
|
$texto_acao</p> |
|
|
<hr> |
|
|
<hr> |
|
|
<p> |
|
|
<p> |
|
|
<a href='$url?txt_hash=$hash_txt'> |
|
|
<a href='$url?hash_txt=$hash_txt'> |
|
|
Clique aqui para excluir seu e-mail da |
|
|
Clique aqui para excluir seu e-mail da |
|
|
lista de envio</a> |
|
|
lista de envio</a> |
|
|
<p> |
|
|
<p> |
|
|
@ -1061,8 +1063,7 @@ def criar_corpo(materia, hash_txt): |
|
|
</body> |
|
|
</body> |
|
|
</html> |
|
|
</html> |
|
|
''') |
|
|
''') |
|
|
url = reverse('acompanhar_excluir', kwargs={'pk': materia.id}) + \ |
|
|
url = reverse('acompanhar_excluir', kwargs={'pk': materia.id}) |
|
|
"?hash="+hash_txt |
|
|
|
|
|
footer = footer_tpl.substitute( |
|
|
footer = footer_tpl.substitute( |
|
|
data=materia.tramitacao_set.last().data_tramitacao, |
|
|
data=materia.tramitacao_set.last().data_tramitacao, |
|
|
status=materia.tramitacao_set.last().status, |
|
|
status=materia.tramitacao_set.last().status, |
|
|
@ -1070,7 +1071,7 @@ def criar_corpo(materia, hash_txt): |
|
|
hash_txt=hash_txt, |
|
|
hash_txt=hash_txt, |
|
|
url=url) |
|
|
url=url) |
|
|
|
|
|
|
|
|
html_email_body = header + autoria + footer |
|
|
html_email_body = header + autoria_html + footer |
|
|
|
|
|
|
|
|
return html_email_body |
|
|
return html_email_body |
|
|
|
|
|
|
|
|
@ -1082,9 +1083,9 @@ def enviar_emails(materia): |
|
|
confirmado=True) |
|
|
confirmado=True) |
|
|
|
|
|
|
|
|
for destinatario in destinatarios: |
|
|
for destinatario in destinatarios: |
|
|
corpo_email = criar_corpo(materia, destinatario.hash_txt) |
|
|
corpo_email_html = criar_html_email(materia, destinatario.hash_txt) |
|
|
send_mail('Mudança de Tramitação', |
|
|
send_mail('Mudança de Tramitação', |
|
|
corpo_email, |
|
|
corpo_email_html, |
|
|
'sapl-test@interlegis.leg.br', |
|
|
'sapl-test@interlegis.leg.br', |
|
|
destinatario, |
|
|
destinatario, |
|
|
fail_silently=True) |
|
|
fail_silently=True) |
|
|
|