mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-04 20:40:14 +03:00
Initial HyperlinkedPrimaryKeyRelatedField class
This commit is contained in:
parent
3a173547ad
commit
f20613a828
|
@ -392,6 +392,15 @@ class HyperlinkedIdentityField(HyperlinkedRelatedField):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
class HyperlinkedPrimaryKeyRelatedField(HyperlinkedRelatedField):
|
||||||
|
"""
|
||||||
|
A read-write field which act like HyperlinkedRelatedField in output and
|
||||||
|
act like PrimaryKeyRelatedField in input
|
||||||
|
"""
|
||||||
|
def to_internal_value(self, data):
|
||||||
|
return self.get_queryset().get(pk=data)
|
||||||
|
|
||||||
|
|
||||||
class SlugRelatedField(RelatedField):
|
class SlugRelatedField(RelatedField):
|
||||||
"""
|
"""
|
||||||
A read-write field that represents the target of the relationship
|
A read-write field that represents the target of the relationship
|
||||||
|
|
Loading…
Reference in New Issue
Block a user