stages/prompt: fix checkbox not working, fix date and datetime not using HTML5 input types

This commit is contained in:
Jens Langhammer 2020-07-09 17:21:46 +02:00
parent 5e6221deb8
commit 8fe6a5b62d
2 changed files with 7 additions and 5 deletions

View File

@ -2,11 +2,11 @@
from os.path import abspath
from time import sleep
from oauth2_provider.generators import generate_client_id, generate_client_secret
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support import expected_conditions as ec
from yaml import safe_dump, safe_load
from oauth2_provider.generators import generate_client_id, generate_client_secret
from docker import DockerClient, from_env
from docker.models.containers import Container

View File

@ -21,7 +21,7 @@ class FieldTypes(models.TextChoices):
_(
(
"Username: Same as Text input, but checks for "
"duplicate and prevents duplicate usernames."
"and prevents duplicate usernames."
)
),
)
@ -77,12 +77,14 @@ class Prompt(models.Model):
kwargs["required"] = False
kwargs["initial"] = self.placeholder
if self.type == FieldTypes.CHECKBOX:
field_class = forms.CheckboxInput
field_class = forms.BooleanField
kwargs["required"] = False
if self.type == FieldTypes.DATE:
field_class = forms.DateInput
attrs["type"] = "date"
widget = forms.DateInput(attrs=attrs)
if self.type == FieldTypes.DATE_TIME:
field_class = forms.DateTimeInput
attrs["type"] = "datetime-local"
widget = forms.DateTimeInput(attrs=attrs)
if self.type == FieldTypes.STATIC:
widget = StaticTextWidget(attrs=attrs)
kwargs["initial"] = self.placeholder