mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-23 10:03:57 +03:00
15 lines
353 B
Python
15 lines
353 B
Python
|
from .models import Foo, Bar
|
||
|
from rest_framework.serializers import HyperlinkedModelSerializer, HyperlinkedIdentityField
|
||
|
|
||
|
|
||
|
class FooSerializer(HyperlinkedModelSerializer):
|
||
|
bar = HyperlinkedIdentityField(view_name='bar-list')
|
||
|
|
||
|
class Meta:
|
||
|
model = Foo
|
||
|
|
||
|
|
||
|
class BarSerializer(HyperlinkedModelSerializer):
|
||
|
class Meta:
|
||
|
model = Bar
|