summaryrefslogtreecommitdiff
path: root/django/contrib/databrowse/plugins/objects.py
diff options
context:
space:
mode:
authorChristopher Long <indirecthit@gmail.com>2007-06-17 22:18:54 +0000
committerChristopher Long <indirecthit@gmail.com>2007-06-17 22:18:54 +0000
commitae22b6d403dcf25098c77f0dfcf59ae58b186461 (patch)
treec37fc631e99a7e4d909d6b6d236f495003731ea7 /django/contrib/databrowse/plugins/objects.py
parent0cf7bc439129c66df8d64601e885f83b256b4f25 (diff)
per-object-permissions: Merged to trunk [5486] NOTE: Not fully tested, will be working on this over the next few weeks.
git-svn-id: http://code.djangoproject.com/svn/django/branches/per-object-permissions@5488 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/contrib/databrowse/plugins/objects.py')
-rw-r--r--django/contrib/databrowse/plugins/objects.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/django/contrib/databrowse/plugins/objects.py b/django/contrib/databrowse/plugins/objects.py
new file mode 100644
index 0000000000..7326566655
--- /dev/null
+++ b/django/contrib/databrowse/plugins/objects.py
@@ -0,0 +1,14 @@
+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, '../'))
+ 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})