Compare commits
No commits in common. "193b9761d0f82c3c54baa4865e4a501323e3e316" and "a1a150b85e8c7bdadb21efe8d3889f3e0a1acd8e" have entirely different histories.
193b9761d0
...
a1a150b85e
1 changed files with 1 additions and 3 deletions
|
@ -51,7 +51,7 @@ def deslugify(title):
|
||||||
if "_" in title:
|
if "_" in title:
|
||||||
title.replace("_", " ")
|
title.replace("_", " ")
|
||||||
return title.title()
|
return title.title()
|
||||||
return re.sub(r"(?<!^)(?=[A-Z])", " ", title).capitalize()
|
return re.sub(r"(?<!^)(?=[A-Z])", "_", title)
|
||||||
|
|
||||||
|
|
||||||
def get_django_field(
|
def get_django_field(
|
||||||
|
@ -85,8 +85,6 @@ 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 choices := field_schema.get("enum"):
|
|
||||||
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":
|
||||||
return models.IntegerField(**kwargs)
|
return models.IntegerField(**kwargs)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue