mirror of
https://github.com/graphql-python/graphene-django.git
synced 2025-06-14 10:33:11 +03:00
Add documentation
This commit is contained in:
parent
ecdbae3c8a
commit
cad37176a6
|
@ -140,3 +140,32 @@ Default: ``False``
|
||||||
# 'messages': ['This field is required.'],
|
# 'messages': ['This field is required.'],
|
||||||
# }
|
# }
|
||||||
# ]
|
# ]
|
||||||
|
|
||||||
|
|
||||||
|
``DJANGO_CHOICE_FIELD_ENUM_V3_NAMING``
|
||||||
|
--------------------------------------
|
||||||
|
|
||||||
|
Set to ``True`` to use the new naming format for the auto generated Enum types from Django choice fields. The new format looks like this: ``DjangoModel{app_label}{object_name}{field_name}Choices``
|
||||||
|
|
||||||
|
Default: ``False``
|
||||||
|
|
||||||
|
|
||||||
|
``DJANGO_CHOICE_FIELD_ENUM_CUSTOM_NAME``
|
||||||
|
--------------------------------------
|
||||||
|
|
||||||
|
Set to a function that takes the Django choice field and returns a string to completely customise the naming for the Enum type.
|
||||||
|
|
||||||
|
If set to a function then the ``DJANGO_CHOICE_FIELD_ENUM_V3_NAMING`` setting is ignored.
|
||||||
|
|
||||||
|
Default: ``None``
|
||||||
|
|
||||||
|
.. code:: python
|
||||||
|
|
||||||
|
def enum_naming(field):
|
||||||
|
if isinstance(field.model, User):
|
||||||
|
return f"CustomUserEnum{field.name.title()}"
|
||||||
|
return f"CustomEnum{field.name.title()}"
|
||||||
|
|
||||||
|
GRAPHENE = {
|
||||||
|
'DJANGO_CHOICE_FIELD_ENUM_CUSTOM_NAME': enum_naming
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user