mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-02-03 13:14:30 +03:00
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?
This commit is contained in:
parent
14586916e2
commit
d3024ff181
|
@ -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):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
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):
|
||||||
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
|
||||||
|
|
Loading…
Reference in New Issue
Block a user