From 4040eb9619a9beb8ae6bc93f49c0170e4f198f15 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Mon, 20 Jul 2020 16:43:30 +0200 Subject: [PATCH] *: remove path-based import from all PropertyMappings --- passbook/providers/saml/models.py | 5 ++++- passbook/sources/ldap/models.py | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/passbook/providers/saml/models.py b/passbook/providers/saml/models.py index 2e7bd68f4..b98c67fae 100644 --- a/passbook/providers/saml/models.py +++ b/passbook/providers/saml/models.py @@ -147,7 +147,10 @@ class SAMLPropertyMapping(PropertyMapping): saml_name = models.TextField(verbose_name="SAML Name") friendly_name = models.TextField(default=None, blank=True, null=True) - form = "passbook.providers.saml.forms.SAMLPropertyMappingForm" + def form(self) -> Type[ModelForm]: + from passbook.providers.saml.forms import SAMLPropertyMappingForm + + return SAMLPropertyMappingForm def __str__(self): return f"SAML Property Mapping {self.saml_name}" diff --git a/passbook/sources/ldap/models.py b/passbook/sources/ldap/models.py index b4581d11d..4fc1ffc3c 100644 --- a/passbook/sources/ldap/models.py +++ b/passbook/sources/ldap/models.py @@ -89,7 +89,10 @@ class LDAPPropertyMapping(PropertyMapping): object_field = models.TextField() - form = "passbook.sources.ldap.forms.LDAPPropertyMappingForm" + def form(self) -> Type[ModelForm]: + from passbook.sources.ldap.forms import LDAPPropertyMappingForm + + return LDAPPropertyMappingForm def __str__(self): return f"LDAP Property Mapping {self.expression} -> {self.object_field}"