info.registration
Overview
Model registration for the meta-info API, mapping models to serializers and viewsets.
get_all_registrations
Get all the registrations.
:return: All the registrations.
Signature
get_all_registrations()
Source
server/vueda/info/registration.py:154
get_registered_content_types
Get all the registered content types.
:return: All the registered content types.
Signature
get_registered_content_types()
Source
server/vueda/info/registration.py:164
get_registration
Get the registration for a content type.
:param content_type: The content type to get the registration for. :return: The registration for the content type.
Signature
get_registration(content_type)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| content_type | yes |
Source
server/vueda/info/registration.py:121
get_serializer_for_model
Return the canonical serializer class registered for model, or None if the model has not been registered. Uses the in-process registry directly, avoiding the ContentType database query required by :func:get_registration.
Signature
get_serializer_for_model(model)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| model | yes |
Source
server/vueda/info/registration.py:143
register
Register a model so that it can be used with ModelInfoViewSet. You should do this in the ready method of an AppConfig, not as a side effect of importing viewsets or serializers.
:param canonical_serializer: The serializer to use as a reference for the model. Only a Meta.model is required; it does not need to inherit VuedaSerializer. The /info/ meta-API falls back to defaults for any VuedaExpandableFieldsSerializerMixin hooks (generate_expand_model_info, get_expand_model_info, get_field_model_info) the serializer doesn't define. :param canonical_viewset: The viewset to use as a reference for the model.
Signature
register(canonical_serializer, canonical_viewset)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| canonical_serializer | yes | ||
| canonical_viewset | yes |
Source
server/vueda/info/registration.py:24
register_serializer
Register a model so that it can be used with ModelInfoViewSet. You should do this in the ready method of an AppConfig, not as a side effect of importing viewsets or serializers.
Because there is no viewset, the info available will be limited to
:param canonical_serializer: The serializer to use as a reference for the model. Only a Meta.model is required; it does not need to inherit VuedaSerializer. The /info/ meta-API falls back to defaults for any VuedaExpandableFieldsSerializerMixin hooks (generate_expand_model_info, get_expand_model_info, get_field_model_info) the serializer doesn't define.
Signature
register_serializer(canonical_serializer)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| canonical_serializer | yes |
Source
server/vueda/info/registration.py:75
Source
server/vueda/info/registration.py