diff --git a/sapl/base/forms.py b/sapl/base/forms.py index 80e6c530a..06f82cb69 100644 --- a/sapl/base/forms.py +++ b/sapl/base/forms.py @@ -36,7 +36,8 @@ from sapl.utils import (autor_label, autor_modal, ChoiceWithoutValidationField, FilterOverridesMetaMixin, FileFieldCheckMixin, AnoNumeroOrderingFilter, ImageThumbnailFileInput, models_with_gr_for_model, qs_override_django_filter, - RangeWidgetOverride, RANGE_ANOS, YES_NO_CHOICES) + RangeWidgetOverride, RANGE_ANOS, YES_NO_CHOICES, + GoogleRecapthaMixin) from .models import AppConfig, CasaLegislativa @@ -1621,29 +1622,22 @@ class ConfiguracoesAppForm(ModelForm): return cleaned_data -class RecuperarSenhaForm(PasswordResetForm): +class RecuperarSenhaForm(GoogleRecapthaMixin, PasswordResetForm): logger = logging.getLogger(__name__) def __init__(self, *args, **kwargs): - row1 = to_row( - [('email', 12)]) - self.helper = SaplFormHelper() - self.helper.layout = Layout( - Fieldset(_('Insira o e-mail cadastrado com a sua conta'), - row1, - form_actions(label='Enviar')) - ) - super(RecuperarSenhaForm, self).__init__(*args, **kwargs) + kwargs['title_label'] = _('Insira o e-mail cadastrado com a sua conta') + kwargs['action_label'] = _('Enviar') + + super().__init__(*args, **kwargs) def clean(self): - super(RecuperarSenhaForm, self).clean() - if not self.is_valid(): - return self.cleaned_data + super(RecuperarSenhaForm, self).clean() - email_existente = User.objects.filter( + email_existente = get_user_model().objects.filter( email=self.data['email']).exists() if not email_existente: diff --git a/sapl/materia/forms.py b/sapl/materia/forms.py index abc2c821d..06aed83c2 100644 --- a/sapl/materia/forms.py +++ b/sapl/materia/forms.py @@ -42,7 +42,8 @@ from sapl.utils import (autor_label, autor_modal, lista_anexados, MateriaPesquisaOrderingFilter, models_with_gr_for_model, qs_override_django_filter, SEPARADOR_HASH_PROPOSICAO, - validar_arquivo, YES_NO_CHOICES) + validar_arquivo, YES_NO_CHOICES, + GoogleRecapthaMixin) from .models import (AcompanhamentoMateria, Anexada, Autoria, DespachoInicial, DocumentoAcessorio, Numeracao, @@ -314,7 +315,7 @@ class UnidadeTramitacaoForm(ModelForm): return unidade -class AcompanhamentoMateriaForm(ModelForm): +class AcompanhamentoMateriaForm(GoogleRecapthaMixin, ModelForm): class Meta: model = AcompanhamentoMateria @@ -322,17 +323,10 @@ class AcompanhamentoMateriaForm(ModelForm): def __init__(self, *args, **kwargs): - row1 = to_row([('email', 12)]) + kwargs['title_label'] = _('Acompanhamento de Matéria por e-mail') + kwargs['action_label'] = _('Cadastrar') - self.helper = SaplFormHelper() - self.helper.layout = Layout( - Fieldset( - _('Acompanhamento de Matéria por e-mail'), - row1, - form_actions(label='Cadastrar') - ) - ) - super(AcompanhamentoMateriaForm, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) class DocumentoAcessorioForm(FileFieldCheckMixin, ModelForm): diff --git a/sapl/protocoloadm/forms.py b/sapl/protocoloadm/forms.py index 427834250..b89fc7183 100644 --- a/sapl/protocoloadm/forms.py +++ b/sapl/protocoloadm/forms.py @@ -26,7 +26,8 @@ from sapl.utils import (AnoNumeroOrderingFilter, autor_label, autor_modal, choice_anos_com_protocolo, choice_force_optional, FileFieldCheckMixin, FilterOverridesMetaMixin, lista_anexados, RANGE_ANOS, - validar_arquivo, YES_NO_CHOICES) + validar_arquivo, YES_NO_CHOICES, + GoogleRecapthaMixin) from .models import (Anexado, AcompanhamentoDocumento, DocumentoAcessorioAdministrativo, @@ -47,7 +48,7 @@ NATUREZA_PROCESSO = [('0', 'Administrativo'), EM_TRAMITACAO = [(0, 'Sim'), (1, 'Não')] -class AcompanhamentoDocumentoForm(ModelForm): +class AcompanhamentoDocumentoForm(GoogleRecapthaMixin, ModelForm): class Meta: model = AcompanhamentoDocumento @@ -55,17 +56,10 @@ class AcompanhamentoDocumentoForm(ModelForm): def __init__(self, *args, **kwargs): - row1 = to_row([('email', 12)]) + kwargs['title_label'] = _('Acompanhamento de Documento por e-mail') + kwargs['action_label'] = _('Cadastrar') - self.helper = SaplFormHelper() - self.helper.layout = Layout( - Fieldset( - _('Acompanhamento de Documento por e-mail'), - row1, - form_actions(label='Cadastrar') - ) - ) - super(AcompanhamentoDocumentoForm, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) class ProtocoloFilterSet(django_filters.FilterSet): diff --git a/sapl/templates/base/recuperar_senha_email_form.html b/sapl/templates/base/recuperar_senha_email_form.html index 9dd798df0..c91117306 100644 --- a/sapl/templates/base/recuperar_senha_email_form.html +++ b/sapl/templates/base/recuperar_senha_email_form.html @@ -1 +1,5 @@ {% extends "crud/form.html" %} + +{% block head_content %}{{block.super}} + +{% endblock %} diff --git a/sapl/templates/materia/acompanhamento_materia.html b/sapl/templates/materia/acompanhamento_materia.html index 90c5929bf..92e3b0a68 100644 --- a/sapl/templates/materia/acompanhamento_materia.html +++ b/sapl/templates/materia/acompanhamento_materia.html @@ -1,7 +1,13 @@ {% extends "crud/detail.html" %} {% load i18n %} {% load crispy_forms_tags %} -{% block actions %} {% endblock %} + +{% block head_content %}{{block.super}} + +{% endblock %} + +{% block actions %}{% endblock %} + {% block detail_content %}