This commit is contained in:
parent
c4700932a5
commit
193b9761d0
1 changed files with 1 additions and 1 deletions
|
@ -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":
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue