aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md1
-rw-r--r--djangorestframework/templatetags/add_query_param.py14
-rw-r--r--docs/index.md1
-rwxr-xr-xsetup.py2
4 files changed, 13 insertions, 5 deletions
diff --git a/README.md b/README.md
index 31450052..e62e19ce 100644
--- a/README.md
+++ b/README.md
@@ -16,7 +16,6 @@ For more information, check out [the documentation][docs], in particular, the tu
* Python (2.6, 2.7)
* Django (1.3, 1.4, 1.5)
-* [URLObject][urlobject] (2.0.0+)
**Optional:**
diff --git a/djangorestframework/templatetags/add_query_param.py b/djangorestframework/templatetags/add_query_param.py
index 4cf0133b..044f543b 100644
--- a/djangorestframework/templatetags/add_query_param.py
+++ b/djangorestframework/templatetags/add_query_param.py
@@ -1,10 +1,20 @@
+from django.http import QueryDict
from django.template import Library
-from urlobject import URLObject
+from urlparse import urlparse, urlunparse
register = Library()
+def replace_query_param(url, key, val):
+ (scheme, netloc, path, params, query, fragment) = urlparse(url)
+ query_dict = QueryDict(query).copy()
+ query_dict[key] = val
+ query = query_dict.urlencode()
+ return urlunparse((scheme, netloc, path, params, query, fragment))
+
+
def add_query_param(url, param):
- return unicode(URLObject(url).with_query(param))
+ key, val = param.split('=')
+ return replace_query_param(url, key, val)
register.filter('add_query_param', add_query_param)
diff --git a/docs/index.md b/docs/index.md
index c2035a19..2376d38e 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -17,7 +17,6 @@ REST framework requires the following:
* Python (2.6, 2.7)
* Django (1.3, 1.4, 1.5)
-* [URLObject][urlobject] (2.0.0+)
The following packages are optional:
diff --git a/setup.py b/setup.py
index 5cd2a28f..2efad481 100755
--- a/setup.py
+++ b/setup.py
@@ -63,7 +63,7 @@ setup(
packages=get_packages('djangorestframework'),
package_data=get_package_data('djangorestframework'),
test_suite='djangorestframework.runtests.runcoverage.main',
- install_requires=['URLObject>=0.6.0'],
+ install_requires=[],
classifiers=[
'Development Status :: 4 - Beta',
'Environment :: Web Environment',