---
url: "https://vueda.dev/v3/reference/api/py/vueda.core.serializers/ExcludeFieldsSerializerMixin.md"
title: "ExcludeFieldsSerializerMixin"
---

# ExcludeFieldsSerializerMixin

## Overview

Make fields read-only for one kind of write, named in the serializer's ``Meta``.

``Meta.exclude_create_fields`` lists fields a ``create`` request cannot set, and
``Meta.exclude_update_fields`` lists fields an ``update`` or ``partial_update`` request cannot set.
The fields stay in responses. Fields made read-only this way still show as writable in OPTIONS
responses: https://github.com/encode/django-rest-framework/discussions/8606#discussioncomment-3899252

The action comes from the view in the serializer's context. When the context has no view, no fields
are excluded and every field keeps its declared writability.

Use a serializer with this mixin only on a ViewSet. Only a ViewSet has an ``action``. A DRF generic
view such as ``UpdateAPIView`` handles writes without one, so the mixin cannot tell a ``create`` from
an ``update``, and a write through it could set every field that the exclusions lock. Building the
fields with any view that has no ``action`` in context raises ``ImproperlyConfigured``.

## `get_extra_kwargs` {#get_extra_kwargs}

### Signature {#get_extra_kwargs-signature}

`get_extra_kwargs(self)`

#### Parameters {#get_extra_kwargs-parameters}

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| self |  | yes |  |  |

### Source {#get_extra_kwargs-source}

`server/vueda/core/serializers/__init__.py:554`

## Source

`server/vueda/core/serializers/__init__.py:536`
