rest_framework_json_api.utils module¶
-
rest_framework_json_api.utils.
get_resource_name
(context, expand_polymorphic_types=False)¶ Return the name of a resource.
-
rest_framework_json_api.utils.
get_serializer_fields
(serializer)¶
-
rest_framework_json_api.utils.
format_field_names
(obj, format_type=None)¶ Takes a dict and returns it with formatted keys as set in format_type or JSON_API_FORMAT_FIELD_NAMES
- Format_type
Either ‘dasherize’, ‘camelize’, ‘capitalize’ or ‘underscore’
-
rest_framework_json_api.utils.
format_keys
(obj, format_type=None)¶ Warning
format_keys function and JSON_API_FORMAT_KEYS setting are deprecated and will be removed in the future. Use format_field_names and JSON_API_FORMAT_FIELD_NAMES instead. Be aware that format_field_names only formats keys and preserves value.
Takes either a dict or list and returns it with camelized keys only if JSON_API_FORMAT_KEYS is set.
- Format_type
Either ‘dasherize’, ‘camelize’, ‘capitalize’ or ‘underscore’
-
rest_framework_json_api.utils.
format_value
(value, format_type=None)¶
-
rest_framework_json_api.utils.
format_relation_name
(value, format_type=None)¶ Warning
The ‘format_relation_name’ function has been renamed ‘format_resource_type’ and the settings are now ‘JSON_API_FORMAT_TYPES’ and ‘JSON_API_PLURALIZE_TYPES’ instead of ‘JSON_API_FORMAT_RELATION_KEYS’ and ‘JSON_API_PLURALIZE_RELATION_TYPE’
-
rest_framework_json_api.utils.
format_resource_type
(value, format_type=None, pluralize=None)¶
-
rest_framework_json_api.utils.
get_resource_type_from_model
(model)¶
-
rest_framework_json_api.utils.
get_resource_type_from_queryset
(qs)¶
-
rest_framework_json_api.utils.
get_resource_type_from_instance
(instance)¶
-
rest_framework_json_api.utils.
get_resource_type_from_manager
(manager)¶
-
rest_framework_json_api.utils.
get_resource_type_from_serializer
(serializer)¶
-
rest_framework_json_api.utils.
get_included_resources
(request, serializer=None)¶ Build a list of included resources.
-
rest_framework_json_api.utils.
get_default_included_resources_from_serializer
(serializer)¶
-
rest_framework_json_api.utils.
get_included_serializers
(serializer)¶
-
rest_framework_json_api.utils.
get_relation_instance
(resource_instance, source, serializer)¶
-
class
rest_framework_json_api.utils.
Hyperlink
¶ Bases:
str
A string like object that additionally has an associated name. We use this for hyperlinked URLs that may render as a named link in some contexts, or render as a plain URL in others.
Comes from Django REST framework 3.2 https://github.com/tomchristie/django-rest-framework
-
is_hyperlink
= True¶
-
-
rest_framework_json_api.utils.
format_drf_errors
(response, context, exc)¶
-
rest_framework_json_api.utils.
format_errors
(data)¶