Compare commits

..

No commits in common. "193b9761d0f82c3c54baa4865e4a501323e3e316" and "a1a150b85e8c7bdadb21efe8d3889f3e0a1acd8e" have entirely different histories.

View file

@ -51,7 +51,7 @@ def deslugify(title):
if "_" in title:
title.replace("_", " ")
return title.title()
return re.sub(r"(?<!^)(?=[A-Z])", " ", title).capitalize()
return re.sub(r"(?<!^)(?=[A-Z])", "_", title)
def get_django_field(
@ -85,8 +85,6 @@ def get_django_field(
max_length = field_schema.get("max_length") or 255
if pattern := field_schema.get("pattern"):
kwargs["validators"].append(RegexValidator(regex=pattern))
if choices := field_schema.get("enum"):
kwargs["choices"] = ((choice, choice) for choice in choices)
return models.CharField(max_length=max_length, **kwargs)
elif field_type == "integer":
return models.IntegerField(**kwargs)