---
url: "https://vueda.dev/v3/reference/api/py/vueda.info.registration.md"
title: "info.registration"
---

# info.registration

## Overview

Model registration for the meta-info API, mapping models to serializers and viewsets.

## `get_all_registrations` {#get_all_registrations}

Get all the registrations.

:return: All the registrations.

### Signature {#get_all_registrations-signature}

`get_all_registrations()`

### Source {#get_all_registrations-source}

`server/vueda/info/registration.py:171`

## `get_registered_content_types` {#get_registered_content_types}

Get all the registered content types.

:return: All the registered content types.

### Signature {#get_registered_content_types-signature}

`get_registered_content_types()`

### Source {#get_registered_content_types-source}

`server/vueda/info/registration.py:181`

## `get_registration` {#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-signature}

`get_registration(content_type)`

#### Parameters {#get_registration-parameters}

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| <span id="get_registration-param-content_type">content_type</span> |  | yes |  |  |

### Source {#get_registration-source}

`server/vueda/info/registration.py:138`

## `get_serializer_for_model` {#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-signature}

`get_serializer_for_model(model)`

#### Parameters {#get_serializer_for_model-parameters}

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| <span id="get_serializer_for_model-param-model">model</span> |  | yes |  |  |

### Source {#get_serializer_for_model-source}

`server/vueda/info/registration.py:160`

## `register` {#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.

Called with both arguments, it registers the model at once and returns ``canonical_viewset``.

Called with only ``canonical_serializer``, it registers nothing and returns a class decorator.
Applying the decorator to a viewset class registers the serializer with that viewset and returns
the class unchanged::

    @register(OrderSerializer)
    class OrderViewSet(VuedaViewSet):
        ...

The decorator form registers the model when Python imports the module that defines the viewset,
so it takes effect only if something imports that module. To register a model without a viewset, use
``register_serializer``.

: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``) that the serializer doesn't define.
:param canonical_viewset: The viewset to use as a reference for the model. When omitted, the call
 returns the class decorator described above.

### Signature {#register-signature}

`register(canonical_serializer, canonical_viewset)`

#### Parameters {#register-parameters}

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| <span id="register-param-canonical_serializer">canonical_serializer</span> |  | yes |  |  |
| <span id="register-param-canonical_viewset">canonical_viewset</span> |  | no | `None` |  |

### Source {#register-source}

`server/vueda/info/registration.py:24`

## `register_serializer` {#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 model info has no actions, filtering, or column totals, and its ordering
 metadata reports only the model's ``Meta.ordering`` default. Fields, expands, permissions, and the field choices
 endpoint work as they do for a model registered with a viewset. The filter choices endpoint answers 404, since
 there is no filterset.

: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``) that the serializer doesn't define.

### Signature {#register_serializer-signature}

`register_serializer(canonical_serializer)`

#### Parameters {#register_serializer-parameters}

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| <span id="register_serializer-param-canonical_serializer">canonical_serializer</span> |  | yes |  |  |

### Source {#register_serializer-source}

`server/vueda/info/registration.py:90`

## Source

`server/vueda/info/registration.py`
