mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-01-24 16:24:18 +03:00
Implement a custom reverse that builds absolute URLs with a request object
This commit is contained in:
parent
a29ca6c2d0
commit
13110a386c
|
@ -1,6 +1,6 @@
|
|||
from django.utils.encoding import smart_unicode
|
||||
from django.utils.xmlutils import SimplerXMLGenerator
|
||||
from django.core.urlresolvers import resolve, reverse
|
||||
from django.core.urlresolvers import resolve, reverse as django_reverse
|
||||
from django.conf import settings
|
||||
|
||||
from djangorestframework.compat import StringIO
|
||||
|
@ -174,5 +174,6 @@ class XMLRenderer():
|
|||
def dict2xml(input):
|
||||
return XMLRenderer().dict2xml(input)
|
||||
|
||||
def reverse(viewname, urlconf=None, args=None, kwargs=None, prefix=None, current_app=None):
|
||||
raise NotImplementedError
|
||||
|
||||
def reverse(viewname, request, *args, **kwargs):
|
||||
return request.build_absolute_uri(django_reverse(viewname, *args, **kwargs))
|
||||
|
|
Loading…
Reference in New Issue
Block a user