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_value(value, format_type=None)
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)

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

rest_framework_json_api.utils.format_drf_errors(response, context, exc)
rest_framework_json_api.utils.format_error_object(message, pointer, response)
rest_framework_json_api.utils.format_errors(data)