mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-26 11:33:59 +03:00
Minor fixes
This commit is contained in:
parent
c91d926b06
commit
cc0d2601b8
|
@ -319,7 +319,7 @@ class HyperlinkedRelatedField(RelatedField):
|
||||||
slug = getattr(obj, self.slug_field, None)
|
slug = getattr(obj, self.slug_field, None)
|
||||||
|
|
||||||
if not slug:
|
if not slug:
|
||||||
raise ValidationError('Could not resolve URL for field using view name "%s"', view_name)
|
raise ValidationError('Could not resolve URL for field using view name "%s"' % view_name)
|
||||||
|
|
||||||
kwargs = {self.slug_url_kwarg: slug}
|
kwargs = {self.slug_url_kwarg: slug}
|
||||||
try:
|
try:
|
||||||
|
@ -374,9 +374,6 @@ class HyperlinkedIdentityField(Field):
|
||||||
"""
|
"""
|
||||||
A field that represents the model's identity using a hyperlink.
|
A field that represents the model's identity using a hyperlink.
|
||||||
"""
|
"""
|
||||||
def __init__(self, *args, **kwargs):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def field_to_native(self, obj, field_name):
|
def field_to_native(self, obj, field_name):
|
||||||
request = self.context.get('request', None)
|
request = self.context.get('request', None)
|
||||||
view_name = self.parent.opts.view_name
|
view_name = self.parent.opts.view_name
|
||||||
|
|
|
@ -260,7 +260,7 @@ class DocumentingHTMLRenderer(BaseRenderer):
|
||||||
serializer = view.get_serializer(instance=obj)
|
serializer = view.get_serializer(instance=obj)
|
||||||
for k, v in serializer.get_fields(True).items():
|
for k, v in serializer.get_fields(True).items():
|
||||||
print k, v
|
print k, v
|
||||||
if v.readonly:
|
if getattr(v, 'readonly', True):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
kwargs = {}
|
kwargs = {}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user