Minor fixes

This commit is contained in:
Tom Christie 2012-10-04 21:36:40 +01:00
parent c91d926b06
commit cc0d2601b8
2 changed files with 2 additions and 5 deletions

View File

@ -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

View File

@ -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 = {}