Fix view_name argument to HyperlinkedIdentityField

This commit is contained in:
Tom Christie 2012-10-05 15:46:45 +01:00
parent 484ee8cc27
commit 102e906840

View File

@ -379,10 +379,8 @@ 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): def __init__(self, *args, **kwargs):
try: # TODO: Make this mandatory
self.view_name = kwargs.pop('view_name') self.view_name = kwargs.pop('view_name', None)
except:
raise ValueError("Hyperlinked field requires 'view_name' kwarg")
super(HyperlinkedRelatedField, self).__init__(*args, **kwargs) super(HyperlinkedRelatedField, self).__init__(*args, **kwargs)
def field_to_native(self, obj, field_name): def field_to_native(self, obj, field_name):