*: Adjust forms to only show respective types of Flows and PropertyMappings

This commit is contained in:
Jens Langhammer
2020-08-01 20:00:20 +02:00
parent fcf70a3cd4
commit d4a5269bf1
6 changed files with 41 additions and 28 deletions

View File

@ -14,9 +14,12 @@ from passbook.providers.saml.models import SAMLPropertyMapping, SAMLProvider
class SAMLProviderForm(forms.ModelForm):
"""SAML Provider form"""
authorization_flow = forms.ModelChoiceField(
queryset=Flow.objects.filter(designation=FlowDesignation.AUTHORIZATION)
)
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.fields["authorization_flow"].queryset = Flow.objects.filter(
designation=FlowDesignation.AUTHORIZATION
)
self.fields["property_mappings"].queryset = SAMLPropertyMapping.objects.all()
class Meta: