fixed typo

This commit is contained in:
Stephan Groß 2012-11-05 16:43:03 +01:00
parent 03095f607a
commit 0a660a531a
2 changed files with 2 additions and 2 deletions

View File

@ -488,7 +488,7 @@ class HyperlinkedRelatedField(RelatedField):
self.view_name = kwargs.pop('view_name') self.view_name = kwargs.pop('view_name')
except: except:
raise ValueError("Hyperlinked field requires 'view_name' kwarg") raise ValueError("Hyperlinked field requires 'view_name' kwarg")
self.slug_url_kwarg = kwargs.pop('slug_url_kwargs', self.slug_url_kwarg) self.slug_url_kwarg = kwargs.pop('slug_url_kwarg', self.slug_url_kwarg)
self.slug_field = kwargs.pop('slug_field', self.slug_field) self.slug_field = kwargs.pop('slug_field', self.slug_field)
self.format = kwargs.pop('format', None) self.format = kwargs.pop('format', None)
super(HyperlinkedRelatedField, self).__init__(*args, **kwargs) super(HyperlinkedRelatedField, self).__init__(*args, **kwargs)

View File

@ -17,7 +17,7 @@ class BlogPostCommentSerializer(serializers.Serializer):
class PhotoSerializer(serializers.Serializer): class PhotoSerializer(serializers.Serializer):
description = serializers.CharField() description = serializers.CharField()
album_url = serializers.HyperlinkedRelatedField(source='album', view_name='album-detail', queryset=Album.objects.all(), slug_field='title', slug_url_kwargs='title') album_url = serializers.HyperlinkedRelatedField(source='album', view_name='album-detail', queryset=Album.objects.all(), slug_field='title', slug_url_kwarg='title')
def restore_object(self, attrs, instance=None): def restore_object(self, attrs, instance=None):
return Photo(**attrs) return Photo(**attrs)