Commit d3024ff1 by Tom Christie

Try to be marginally less awful if we can't reverse resolve the URL for a model.…

Try to be marginally less awful if we can't reverse resolve the URL for a model.  TODO: Give up on even trying to do such black magic in the first place?
parent 14586916
...@@ -6,7 +6,7 @@ from django.db.models.fields.related import RelatedField ...@@ -6,7 +6,7 @@ from django.db.models.fields.related import RelatedField
from django.utils.encoding import smart_unicode from django.utils.encoding import smart_unicode
from djangorestframework.response import ErrorResponse from djangorestframework.response import ErrorResponse
from djangorestframework.serializer import Serializer from djangorestframework.serializer import Serializer, _SkipField
from djangorestframework.utils import as_tuple from djangorestframework.utils import as_tuple
import decimal import decimal
...@@ -342,7 +342,7 @@ class ModelResource(FormResource): ...@@ -342,7 +342,7 @@ class ModelResource(FormResource):
""" """
if not hasattr(self, 'view_callable'): if not hasattr(self, 'view_callable'):
raise NoReverseMatch raise _SkipField
# dis does teh magicks... # dis does teh magicks...
urlconf = get_urlconf() urlconf = get_urlconf()
...@@ -371,7 +371,7 @@ class ModelResource(FormResource): ...@@ -371,7 +371,7 @@ class ModelResource(FormResource):
return reverse(self.view_callable[0], kwargs=instance_attrs) return reverse(self.view_callable[0], kwargs=instance_attrs)
except NoReverseMatch: except NoReverseMatch:
pass pass
raise NoReverseMatch raise _SkipField
@property @property
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment