mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-22 17:47:04 +03:00
update style of the note
This commit is contained in:
parent
5342f22009
commit
4a6d27ccbb
|
@ -187,7 +187,7 @@ This renderer is suitable for CRUD-style web APIs that should also present a use
|
|||
|
||||
Note that views that have nested or list serializers for their input won't work well with the `AdminRenderer`, as the HTML forms are unable to properly support them.
|
||||
|
||||
**Note**: In ModelSerializer to get proper links to detail page in `ListCreateAPIView` or `ListAPIView` you should implement `url` field in serializer which return correct link. For example here we use models `get_absolute_url` method:
|
||||
**Note**: The `AdminRenderer` is only able to include links to detail pages when a properly configured `URL_FIELD_NAME` (`url` by default) attribute is present in the data. For `HyperlinkedModelSerializer` this will be the case, but for `ModelSerializer` or plain `Serializer` classes you'll need to make sure to include the field explicitly. For example here we use models `get_absolute_url` method:
|
||||
|
||||
class AccountSerializer(serializers.ModelSerializer):
|
||||
url = serializers.CharField(source='get_absolute_url', read_only=True)
|
||||
|
|
Loading…
Reference in New Issue
Block a user