mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-10 19:56:59 +03:00
Add missed files for test.
This commit is contained in:
parent
b09ef28959
commit
0ee2edc0a1
9
tests/browsable_api/models.py
Normal file
9
tests/browsable_api/models.py
Normal file
|
@ -0,0 +1,9 @@
|
|||
from django.db import models
|
||||
|
||||
|
||||
class Foo(models.Model):
|
||||
name = models.CharField(max_length=30)
|
||||
|
||||
|
||||
class Bar(models.Model):
|
||||
foo = models.ForeignKey("Foo", editable=False)
|
14
tests/browsable_api/serializers.py
Normal file
14
tests/browsable_api/serializers.py
Normal file
|
@ -0,0 +1,14 @@
|
|||
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
|
Loading…
Reference in New Issue
Block a user