mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-01-24 08:14:16 +03:00
Note widget attribute on serializer field. Closes #836.
This commit is contained in:
parent
8d4bcb4b4c
commit
441cdf8065
|
@ -146,6 +146,8 @@ The first thing we need to get started on our Web API is provide a way of serial
|
||||||
|
|
||||||
The first part of serializer class defines the fields that get serialized/deserialized. The `restore_object` method defines how fully fledged instances get created when deserializing data.
|
The first part of serializer class defines the fields that get serialized/deserialized. The `restore_object` method defines how fully fledged instances get created when deserializing data.
|
||||||
|
|
||||||
|
Notice that we can also use various attributes that would typcially be used on form fields, such as `widget=widgets.Testarea`. These can be used to control how the serializer should render when displayed as an HTML form.
|
||||||
|
|
||||||
We can actually also save ourselves some time by using the `ModelSerializer` class, as we'll see later, but for now we'll keep our serializer definition explicit.
|
We can actually also save ourselves some time by using the `ModelSerializer` class, as we'll see later, but for now we'll keep our serializer definition explicit.
|
||||||
|
|
||||||
## Working with Serializers
|
## Working with Serializers
|
||||||
|
|
Loading…
Reference in New Issue
Block a user