Django Settings¶
Certain features of this library are configured using custom Django settings.
STRAWBERRY_DJANGO¶
A dictionary with the following optional keys:
-
FIELD_DESCRIPTION_FROM_HELP_TEXT(default:False)If True, GraphQL field's description will be fetched from the corresponding Django model field's
help_textattribute. If a description is provided using field customization, that description will be used instead. -
TYPE_DESCRIPTION_FROM_MODEL_DOCSTRING(default:False)If True, GraphQL type descriptions will be fetched from the corresponding Django model's docstring. If a description is provided using the
strawberry_django.typedecorator, that description will be used instead. -
MUTATIONS_DEFAULT_ARGUMENT_NAME(default:"data")Change the CUD mutations' default argument name when no option is passed (e.g. to
"input") -
MUTATIONS_DEFAULT_HANDLE_ERRORS(default:False)Set the default behaviour of the Django Errors Handling when no option is passed.
-
GENERATE_ENUMS_FROM_CHOICES(default:False)If True, fields with
choiceswill have automatically generate an enum of possibilities instead of being exposed asString. A better option is to use Django's TextChoices/IntegerChoices with the django-choices-field integration. -
MAP_AUTO_ID_AS_GLOBAL_ID(default:False)If True,
autofields that refer to model ids will be mapped torelay.GlobalIDinstead ofstrawberry.ID. This is mostly useful if all your model types inherit fromrelay.Nodeand you want to work only withGlobalID. -
DEFAULT_PK_FIELD_NAME(default:"pk")Change the CRUD mutations' default primary key field.
-
USE_DEPRECATED_FILTERS(default:False)If True, legacy filters are enabled. This is usefull for migrating from previous version.
These features can be enabled by adding this code to your settings.py file.