Skip to content

ModelPrimaryKeyValueField ​

Overview ​

Converts one primary key value to the value that a pk filter on model expects.

The model's primary key field does the conversion, so a UUID, string, or other key type converts the way the database lookup needs it. A composite key arrives as its JSON array string, such as '["1", "42"]', the same form that the detail route takes. It converts to a tuple of column values. A value that the key field cannot convert fails as invalid.

__init__ ​

When a field is instantiated, we store the arguments that were used, so that we can present a helpful representation of the object.

Signature ​

__init__(args, kwargs)

Parameters ​

NameTypeRequiredDefaultDescription
argsno
kwargsno

Source ​

.venv/lib/python3.12/site-packages/rest_framework/fields.py:615

to_internal_value ​

Transform the incoming primitive data into a native value.

Signature ​

to_internal_value(self, data)

Parameters ​

NameTypeRequiredDefaultDescription
selfyes
datayes

Source ​

server/vueda/core/serializers/__init__.py:82

to_representation ​

Transform the outgoing native value into primitive data.

Signature ​

to_representation(self, value)

Parameters ​

NameTypeRequiredDefaultDescription
selfyes
valueyes

Source ​

server/vueda/core/serializers/__init__.py:96

default_error_messages ​

model ​

Source ​

server/vueda/core/serializers/__init__.py:66