diff --git a/sapl/base/forms.py b/sapl/base/forms.py index 30f4f47e5..f8667a5c4 100644 --- a/sapl/base/forms.py +++ b/sapl/base/forms.py @@ -1611,7 +1611,8 @@ class ConfiguracoesAppForm(ModelForm): 'tramitacao_materia', 'tramitacao_documento', 'google_recaptcha_site_key', - 'google_recaptcha_secret_key'] + 'google_recaptcha_secret_key', + 'sapl_as_sapn'] def __init__(self, *args, **kwargs): super(ConfiguracoesAppForm, self).__init__(*args, **kwargs) diff --git a/sapl/base/migrations/0044_appconfig_sapl_as_sapn.py b/sapl/base/migrations/0044_appconfig_sapl_as_sapn.py new file mode 100644 index 000000000..3fcb96d5a --- /dev/null +++ b/sapl/base/migrations/0044_appconfig_sapl_as_sapn.py @@ -0,0 +1,18 @@ +# Generated by Django 2.2.13 on 2021-02-28 00:45 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('base', '0043_auto_20210203_1442'), + ] + + operations = [ + migrations.AddField( + model_name='appconfig', + name='sapl_as_sapn', + field=models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], default=False, verbose_name='Utilizar SAPL com SAPN?'), + ), + ] diff --git a/sapl/base/migrations/0045_auto_20210301_1537.py b/sapl/base/migrations/0045_auto_20210301_1537.py new file mode 100644 index 000000000..d10898b4f --- /dev/null +++ b/sapl/base/migrations/0045_auto_20210301_1537.py @@ -0,0 +1,18 @@ +# Generated by Django 2.2.13 on 2021-03-01 18:37 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('base', '0044_appconfig_sapl_as_sapn'), + ] + + operations = [ + migrations.AlterField( + model_name='appconfig', + name='sapl_as_sapn', + field=models.BooleanField(choices=[(True, 'Sim'), (False, 'Não')], default=False, verbose_name='Utilizar SAPL como SAPN?'), + ), + ] diff --git a/sapl/base/models.py b/sapl/base/models.py index aabdd88f3..ae5db11a8 100644 --- a/sapl/base/models.py +++ b/sapl/base/models.py @@ -200,6 +200,11 @@ class AppConfig(models.Model): verbose_name=_('Chave privada gerada pelo Google Recaptcha'), max_length=256, default='') + sapl_as_sapn = models.BooleanField( + verbose_name=_( + 'Utilizar SAPL como SAPN?'), + choices=YES_NO_CHOICES, default=False) + class Meta: verbose_name = _('Configurações da Aplicação') verbose_name_plural = _('Configurações da Aplicação') diff --git a/sapl/base/templatetags/common_tags.py b/sapl/base/templatetags/common_tags.py index 048778d8d..56d7d356e 100644 --- a/sapl/base/templatetags/common_tags.py +++ b/sapl/base/templatetags/common_tags.py @@ -51,6 +51,13 @@ def model_verbose_name_plural(class_name): model = get_class(class_name) return model._meta.verbose_name_plural +@register.filter +def meta_model_value(instance, attr): + try: + return getattr(instance._meta, attr) + except: + return '' + @register.filter def split(value, arg): @@ -324,12 +331,12 @@ def render_chunk_vendors(extension=None): return mark_safe('\n'.join(tags)) except: return '' - - + + @register.filter(is_safe=True) -@stringfilter +@stringfilter def dont_break_out(value): _safe = '