summaryrefslogtreecommitdiff
path: root/django/contrib/admin/widgets.py
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2009-07-23 14:31:33 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2009-07-23 14:31:33 +0000
commit53d16b1175682f1ff97358b67190e4c935372b26 (patch)
treeffdc71bbea53b9d0a73882611ef65a1ff84e5fc3 /django/contrib/admin/widgets.py
parenta135608d910d0ec2ed03651908a454aa1ba34b9a (diff)
Fixed #11532 -- Corrected the link used for edit_inline foreign keys in admin when the admin is deployed using the old style admin.root approach. Thanks to JP for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11314 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/contrib/admin/widgets.py')
-rw-r--r--django/contrib/admin/widgets.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/django/contrib/admin/widgets.py b/django/contrib/admin/widgets.py
index 1a081bc293..eacea44a31 100644
--- a/django/contrib/admin/widgets.py
+++ b/django/contrib/admin/widgets.py
@@ -224,7 +224,8 @@ class RelatedFieldWidgetWrapper(forms.Widget):
try:
related_url = reverse('admin:%s_%s_add' % info, current_app=self.admin_site.name)
except NoReverseMatch:
- related_url = '../../../%s/%s/add/' % info
+ info = (self.admin_site.root_path, rel_to._meta.app_label, rel_to._meta.object_name.lower())
+ related_url = '%s%s/%s/add/' % info
self.widget.choices = self.choices
output = [self.widget.render(name, value, *args, **kwargs)]
if rel_to in self.admin_site._registry: # If the related object has an admin interface: