sources/ldap: fix expression field not being CodeMirror

This commit is contained in:
Jens Langhammer 2020-06-05 20:18:45 +02:00
parent 9f3f34389e
commit 7664b428e7
2 changed files with 16 additions and 0 deletions

View file

@ -2,8 +2,10 @@
from django import forms
from django.contrib.admin.widgets import FilteredSelectMultiple
from django.utils.html import mark_safe
from django.utils.translation import gettext as _
from passbook.admin.fields import CodeMirrorWidget
from passbook.core.expression import PropertyMappingEvaluator
from passbook.providers.saml.models import (
SAMLPropertyMapping,
@ -68,4 +70,13 @@ class SAMLPropertyMappingForm(forms.ModelForm):
"name": forms.TextInput(),
"saml_name": forms.TextInput(),
"friendly_name": forms.TextInput(),
"expression": CodeMirrorWidget(mode="python"),
}
help_texts = {
"saml_name": mark_safe(
_(
"URN OID used by SAML. This is optional. "
'<a href="https://www.rfc-editor.org/rfc/rfc2798.html#section-2">Reference</a>'
)
),
}

View file

@ -4,6 +4,7 @@ from django import forms
from django.contrib.admin.widgets import FilteredSelectMultiple
from django.utils.translation import gettext_lazy as _
from passbook.admin.fields import CodeMirrorWidget
from passbook.admin.forms.source import SOURCE_FORM_FIELDS
from passbook.core.expression import PropertyMappingEvaluator
from passbook.sources.ldap.models import LDAPPropertyMapping, LDAPSource
@ -68,4 +69,8 @@ class LDAPPropertyMappingForm(forms.ModelForm):
"name": forms.TextInput(),
"ldap_property": forms.TextInput(),
"object_field": forms.TextInput(),
"expression": CodeMirrorWidget(mode="python"),
}
help_texts = {
"object_field": _("Field of the user object this value is written to.")
}