Dynamic service ordering forms #27

Merged
rixx merged 14 commits from 14-dynamic-service-ordering-forms into main 2025-03-26 14:43:16 +00:00
Showing only changes of commit 193b9761d0 - Show all commits

View file

@ -85,7 +85,7 @@ def get_django_field(
max_length = field_schema.get("max_length") or 255 max_length = field_schema.get("max_length") or 255
if pattern := field_schema.get("pattern"): if pattern := field_schema.get("pattern"):
kwargs["validators"].append(RegexValidator(regex=pattern)) kwargs["validators"].append(RegexValidator(regex=pattern))
if field_schema.get("items") and (choices := field_schema["items"].get("enum")): if choices := field_schema.get("enum"):
kwargs["choices"] = ((choice, choice) for choice in choices) kwargs["choices"] = ((choice, choice) for choice in choices)
return models.CharField(max_length=max_length, **kwargs) return models.CharField(max_length=max_length, **kwargs)
elif field_type == "integer": elif field_type == "integer":