lenticular_cloud2/specs/api_template/str_enum.py.jinja
2022-02-19 10:22:21 +01:00

10 lines
225 B
Django/Jinja

from enum import Enum
class {{ enum.class_info.name }}(str, Enum):
{% for key, value in enum.values.items() %}
{{ key }} = "{{ value }}"
{% endfor %}
def __str__(self) -> str:
return str(self.value)