diff options
| author | Aymeric Augustin <aymeric.augustin@m4x.org> | 2012-07-20 15:36:52 +0200 |
|---|---|---|
| committer | Aymeric Augustin <aymeric.augustin@m4x.org> | 2012-07-22 09:29:55 +0200 |
| commit | 0d914d08a0d7b5a1521f498a8047971fe6cd61e7 (patch) | |
| tree | d0ab08b0b5b2041bd796c10a26a358ae60d0914a /django/contrib/databrowse/plugins/objects.py | |
| parent | bdca5ea345c548a82a80d198906818c9ccbef896 (diff) | |
[py3] Updated urllib/urllib2/urlparse imports.
Lots of functions were moved. Use explicit imports in all cases
to keey it easy to identify where the functions come from.
Diffstat (limited to 'django/contrib/databrowse/plugins/objects.py')
| -rw-r--r-- | django/contrib/databrowse/plugins/objects.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/django/contrib/databrowse/plugins/objects.py b/django/contrib/databrowse/plugins/objects.py index 7326566655..e956f4ea67 100644 --- a/django/contrib/databrowse/plugins/objects.py +++ b/django/contrib/databrowse/plugins/objects.py @@ -1,14 +1,18 @@ +try: + from urllib.parse import urljoin +except ImportError: # Python 2 + from urlparse import urljoin + from django import http from django.contrib.databrowse.datastructures import EasyModel from django.contrib.databrowse.sites import DatabrowsePlugin from django.shortcuts import render_to_response -import urlparse class ObjectDetailPlugin(DatabrowsePlugin): def model_view(self, request, model_databrowse, url): # If the object ID wasn't provided, redirect to the model page, which is one level up. if url is None: - return http.HttpResponseRedirect(urlparse.urljoin(request.path, '../')) + return http.HttpResponseRedirect(urljoin(request.path, '../')) easy_model = EasyModel(model_databrowse.site, model_databrowse.model) obj = easy_model.object_by_pk(url) return render_to_response('databrowse/object_detail.html', {'object': obj, 'root_url': model_databrowse.site.root_url}) |
