names: Create a generic TLS domain selection form

Signed-off-by: Joseph Nuthalapati <njoseph@riseup.net>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Joseph Nuthalapati authored and James Valleroy committed 2021-11-21 19:04:35 -05:00
1 parent 5c62fc7599
commit a912c867c8
5 files changed
+32 -37

No files matched your search

+18
View File
@@ -39,6 +39,24 @@ class DomainSelectionForm(forms.Form):
'changed later.'), choices=[])
class TLSDomainForm(forms.Form):
"""Form to select a TLS domain for an app."""
def get_domain_choices():
"""Double domain entries for inclusion in the choice field."""
from plinth.modules.names import get_available_tls_domains
return ((domain, domain) for domain in get_available_tls_domains())
domain = forms.ChoiceField(
choices=get_domain_choices(),
label=_('TLS domain'),
help_text=_(
'Select a domain to use TLS with. If the list is empty, please '
'configure at least one domain with certificates.'),
required=False,
)
class LanguageSelectionFormMixin:
"""Form mixin for selecting the user's preferred language."""